Skip to content

Commit 46e997b

Browse files
committed
use Stderr
1 parent 74d73dd commit 46e997b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cmd/dbc/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ func failSubcommandAndSuggest(p *arg.Parser, msg string, subcommand ...string) {
190190
}
191191
}
192192

193-
p.WriteUsageForSubcommand(os.Stdout, subcommand...)
194-
fmt.Fprintf(os.Stdout, "error: %s", msg)
193+
p.WriteUsageForSubcommand(os.Stderr, subcommand...)
194+
fmt.Fprintf(os.Stderr, "error: %s", msg)
195195

196196
// Optionally add suggestion
197197
if invalidCmd != "" {
@@ -231,15 +231,15 @@ func main() {
231231
}
232232

233233
if p.Subcommand() == nil {
234-
p.WriteHelp(os.Stdout)
234+
p.WriteHelp(os.Stderr)
235235
os.Exit(1)
236236
}
237237

238238
var m tea.Model
239239

240240
switch sub := p.Subcommand().(type) {
241241
case *AuthCmd:
242-
p.WriteHelpForSubcommand(os.Stdout, p.SubcommandNames()...)
242+
p.WriteHelpForSubcommand(os.Stderr, p.SubcommandNames()...)
243243
os.Exit(2)
244244
case *completions.Cmd: // "dbc completions" without specifying the shell type
245245
p.WriteHelpForSubcommand(os.Stdout, p.SubcommandNames()...)

0 commit comments

Comments
 (0)