summaryrefslogtreecommitdiff
path: root/parse.go
diff options
context:
space:
mode:
authorAlex Flint <[email protected]>2024-09-05 17:15:02 -0400
committerAlex Flint <[email protected]>2024-09-05 17:15:02 -0400
commitb13a62172a12a2b2f0cfd7eeed10d846845a5f77 (patch)
treef4f864ba9a8f3e9730d45f38a3ba7205e85ae4fe /parse.go
parent7cf32414afe6f8db280ac2840ee76fdc41611db8 (diff)
update api docs for Parser.Parse
Diffstat (limited to 'parse.go')
-rw-r--r--parse.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/parse.go b/parse.go
index 2bed8bf..8f99a21 100644
--- a/parse.go
+++ b/parse.go
@@ -494,7 +494,14 @@ func cmdFromStruct(name string, dest path, t reflect.Type) (*command, error) {
}
// Parse processes the given command line option, storing the results in the field
-// of the structs from which NewParser was constructed
+// of the structs from which NewParser was constructed.
+//
+// It returns ErrHelp if "--help" is one of the command line args and ErrVersion if
+// "--version" is one of the command line args (the latter only applies if the
+// destination struct passed to NewParser implements Versioned.)
+//
+// To respond to --help and --version in the way that MustParse does, see examples
+// in the README under "Custom handling of --help and --version".
func (p *Parser) Parse(args []string) error {
err := p.process(args)
if err != nil {