diff options
| author | Alex Flint <[email protected]> | 2016-09-08 21:26:12 -0700 |
|---|---|---|
| committer | Alex Flint <[email protected]> | 2016-09-08 21:26:12 -0700 |
| commit | f882700b723834ad1371307b81930cde4b81c0aa (patch) | |
| tree | f3fd21042b15291d79e259bdfaffe458437d1c56 | |
| parent | c453aa1a28b0cc9baac51cf5cc04df2688d3cd25 (diff) | |
add to readme
| -rw-r--r-- | README.md | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -166,6 +166,28 @@ usage: samples [--foo FOO] [--bar BAR] error: you must provide one of --foo and --bar ``` +### Version strings + +```go +type args struct { + ... +} + +func (args) Version() string { + return "someprogram 4.3.0" +} + +func main() { + var args args + arg.MustParse(&args) +} +``` + +```shell +$ ./example --version +someprogram 4.3.0 +``` + ### Custom parsing You can implement your own argument parser by implementing `encoding.TextUnmarshaler`: |
