Thanks to visit codestin.com
Credit goes to github.com

Skip to content

--help incorrectly exits with exit code 1 #136

@lox

Description

@lox

Correctly calling --help shouldn't fail with exit code 1, it should be exit code 0. With the test program:

var (
  verbose = kingpin.Flag("verbose", "Verbose mode.").Short('v').Bool()
  name    = kingpin.Arg("name", "Name of user.").Required().String()
)

func main() {
  kingpin.Parse()
  fmt.Printf("%v, %s\n", *verbose, *name)
}
 ~  › go run test.go --help
usage: test [<flags>] <name>

Flags:
      --help     Show context-sensitive help (also try --help-long and --help-man).
  -v, --verbose  Verbose mode.

Args:
  <name>  Name of user.

exit status 1
✗ exit 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions