summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorAlex Flint <[email protected]>2024-09-05 17:17:34 -0400
committerGitHub <[email protected]>2024-09-05 17:17:34 -0400
commit3925edf11a926d46a241b837e0712093ecc3f174 (patch)
treebbce649c6e0950c0f382edbf86f814fe29a002e2 /README.md
parent7cf32414afe6f8db280ac2840ee76fdc41611db8 (diff)
parent12fffac1d812461638322f8eed15b1b740e38040 (diff)
Merge pull request #270 from alexflint/parse-docs
Update API docs for Parser.Parse
Diffstat (limited to 'README.md')
-rw-r--r--README.md14
1 files changed, 4 insertions, 10 deletions
diff --git a/README.md b/README.md
index 9b8b071..761af56 100644
--- a/README.md
+++ b/README.md
@@ -582,7 +582,7 @@ if p.Subcommand() == nil {
```
-### Programmatic error handling
+### Custom handling of --help and --version
The following reproduces the internal logic of `MustParse` for the simple case where
you are not using subcommands or --version. This allows you to respond
@@ -625,9 +625,6 @@ Usage: ./example --something SOMETHING
$ ./example
error: --something is required
Usage: ./example --something SOMETHING
-
-$ ./example --something abc
-got "abc"
```
To also handle --version programatically, use the following:
@@ -686,13 +683,10 @@ Usage: example --something SOMETHING
$ ./example
error: --something is required
Usage: example --something SOMETHING
-
-$ ./example --something abc
-got "abc"
```
-To also handle subcommands, use this most general version (also works in absence of subcommands but
-is a bit more complex):
+To generate subcommand-specific help messages, use the following most general version
+(this also works in absence of subcommands but is a bit more complex):
```go
type fetchCmd struct {
@@ -761,7 +755,7 @@ Global options:
### API Documentation
-https://godoc.org/github.com/alexflint/go-arg
+https://pkg.go.dev/github.com/alexflint/go-arg
### Rationale