Skip to content

Commit

Permalink
use flag.CommandLine.Name
Browse files Browse the repository at this point in the history
  • Loading branch information
sentriz committed May 26, 2024
1 parent 19ef90e commit c3be9a3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cliphist.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var version string
func main() {
flag.Usage = func() {
fmt.Fprintf(flag.CommandLine.Output(), "usage:\n")
fmt.Fprintf(flag.CommandLine.Output(), " $ %s <store|list|decode|delete|delete-query|wipe|version>\n", os.Args[0])
fmt.Fprintf(flag.CommandLine.Output(), " $ %s <store|list|decode|delete|delete-query|wipe|version>\n", flag.CommandLine.Name())
fmt.Fprintf(flag.CommandLine.Output(), "options:\n")
flag.VisitAll(func(f *flag.Flag) {
fmt.Fprintf(flag.CommandLine.Output(), " -%s (default %s)\n", f.Name, f.DefValue)
Expand Down Expand Up @@ -74,9 +74,9 @@ func main() {
case "wipe":
err = wipe(*dbPath)
case "version":
fmt.Fprintf(os.Stderr, "%s\t%s\n", "version", strings.TrimSpace(version))
fmt.Fprintf(flag.CommandLine.Output(), "%s\t%s\n", "version", strings.TrimSpace(version))
flag.VisitAll(func(f *flag.Flag) {
fmt.Fprintf(os.Stderr, "%s\t%s\n", f.Name, f.Value)
fmt.Fprintf(flag.CommandLine.Output(), "%s\t%s\n", f.Name, f.Value)
})
default:
flag.Usage()
Expand Down

0 comments on commit c3be9a3

Please sign in to comment.