Closed c4milo closed 6 years ago
This is possible on a fork that I have: https://github.com/aviddiviner/docopt-go#api
You can do it by setting a custom HelpHandler
as follows:
usage := `...`
parser := &docopt.Parser{
HelpHandler: func(err error, short string) {
fmt.Fprintln(os.Stderr, usage) // Print full usage every time.
os.Exit(0)
},
}
opts, err := parser.ParseArgs(usage, argv, "")
flag, _ := opts.Bool("--flag")
secs, _ := opts.Int("<seconds>")
Is there a way to print the entire usage string as opposed to only the Usage section parsed by docopt?