Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add usage string and document stdin/stdout behavior. #51

Merged
merged 2 commits into from
Nov 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Inline method as external call is no longer needed.
  • Loading branch information
nanaze committed Nov 16, 2024
commit 9e266961ebf7e17529c2b768846dfe16a1d905af
10 changes: 3 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ import (
flag "github.com/spf13/pflag"
)

func PrintUsage() {
fmt.Fprintf(os.Stderr, "Usage: %s [flags] file1 [file2 ...]\n\n", path.Base(os.Args[0]))
fmt.Fprint(os.Stderr, "Note that '-' can be used to read from stdin, "+
"in which case the output is written to stdout.\n\n")
}

func main() {
c := &cmd.Config{}
c.FromFlags(nil)
Expand All @@ -45,7 +39,9 @@ func main() {
}

flag.Usage = func() {
PrintUsage()
fmt.Fprintf(os.Stderr, "Usage: %s [flags] file1 [file2 ...]\n\n", path.Base(os.Args[0]))
fmt.Fprint(os.Stderr, "Note that '-' can be used to read from stdin, "+
"in which case the output is written to stdout.\n\n")
fmt.Fprintln(os.Stderr, "Flags:")
nanaze marked this conversation as resolved.
Show resolved Hide resolved
flag.PrintDefaults()
}
Expand Down
Loading