Skip to content

Commit

Permalink
print --help output to stdout, not stderr (like tridge rsync)
Browse files Browse the repository at this point in the history
related to #35
  • Loading branch information
stapelberg committed Feb 5, 2025
1 parent 732f2ea commit 23f7226
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions internal/daemonmaincmd/maincmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ func Main(ctx context.Context, args []string, stdin io.Reader, stdout io.Writer,
opts, opt := rsyncd.NewGetOpt()
remaining, err := opt.Parse(args[1:])
if opt.Called("help") {
fmt.Fprint(stderr, opt.Help())
os.Exit(0) // exit with code 0 for compatibility with tridge rsync
fmt.Println(opt.Help()) // tridge rsync prints help to stdout
os.Exit(0) // exit with code 0 for compatibility with tridge rsync
}
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions internal/receivermaincmd/receivermaincmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@ func Main(args []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) (*
opts, opt := NewGetOpt()
remaining, err := opt.Parse(args[1:])
if opt.Called("help") {
fmt.Fprintln(os.Stderr, opt.Help())
return nil, nil // exit with code 0 for compatibility with tridge rsync
fmt.Println(opt.Help()) // tridge rsync prints help to stdout
return nil, nil // exit with code 0 for compatibility with tridge rsync
}
if err != nil {
return nil, err
Expand Down

0 comments on commit 23f7226

Please sign in to comment.