From f882700b723834ad1371307b81930cde4b81c0aa Mon Sep 17 00:00:00 2001 From: Alex Flint Date: Thu, 8 Sep 2016 21:26:12 -0700 Subject: [PATCH] add to readme --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/README.md b/README.md index 66a9b46..4aa311e 100644 --- a/README.md +++ b/README.md @@ -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`: