Skip to content

Commit a340a00

Browse files
committed
fix(errno): Capitalize error text
1 parent c0df526 commit a340a00

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

cmd/errno/cmd_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ func TestErrno(t *testing.T) {
1919
want string
2020
wantErr require.ErrorAssertionFunc
2121
}{
22-
{"number", []string{"32"}, "EPIPE 32 broken pipe\n", require.NoError},
23-
{"name", []string{"EPIPE"}, "EPIPE 32 broken pipe\n", require.NoError},
24-
{"search", []string{"-s", "broken"}, "EPIPE 32 broken pipe\n", require.NoError},
22+
{"number", []string{"32"}, "EPIPE 32 Broken pipe\n", require.NoError},
23+
{"name", []string{"EPIPE"}, "EPIPE 32 Broken pipe\n", require.NoError},
24+
{"search", []string{"-s", "broken"}, "EPIPE 32 Broken pipe\n", require.NoError},
2525
}
2626
for _, tt := range tests {
2727
t.Run(tt.name, func(t *testing.T) {

cmd/errno/run_unix.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ func run(cmd *cobra.Command, args []string) error {
6969
}
7070

7171
func printErrno(cmd *cobra.Command, e *errno.Errno) error {
72-
_, err := fmt.Fprintf(cmd.OutOrStdout(), "%s %d %s\n", e.Name(), uint(e.Errno), e.Error())
72+
pretty := e.Error()
73+
pretty = strings.ToUpper(pretty[0:1]) + pretty[1:]
74+
_, err := fmt.Fprintf(cmd.OutOrStdout(), "%s %d %s\n", e.Name(), uint(e.Errno), pretty)
7375
return err
7476
}

0 commit comments

Comments
 (0)