Commit Graph

5 Commits

Author SHA1 Message Date
Kenneth Shaw d4c2b35b2e Adding separate tag option
As outlined in #49, there is a need to mimic the behavior of other
applications by interweaving positional and non-positional parameters.

This change adds the 'separate' option that will force a arg of type
[]string to only read the next supplied value.

For example, when dealing with the following arg type:

var MyArgs struct {
    Pos []string `arg:"positional"`
    Separate []string `arg:"-s,separate"`
}

This commit will parse the following command line:

./app pos1 pos2 -s=separate1 -s=separate2 pos3 -s=separate3 pos4

Such that MyArgs.Pos will be [pos1 pos2 pos3 pos4] and MyArgs.Separate
will be [separate1 separate2 separate3].

Unit tests for the above have also been written and are included in this
commit, as well as the addition of a section to README.md and an example
func in example_test.go.

Fixes #49
2017-03-04 09:13:12 +07:00
Alex Flint 5800b89ce9 fix example function names 2016-07-31 09:14:44 -07:00
Alex Flint 8b5a16fafe fix examples 2015-11-01 13:36:14 -08:00
Alex Flint f042ab6386 add .travis.yml 2015-11-01 13:24:35 -08:00
Alex Flint beede9329a added runnable examples 2015-11-01 11:34:22 -08:00