Commit Graph

24 Commits

Author SHA1 Message Date
Alex Flint f2f876420c Merge remote-tracking branch 'origin/master' into usage-for-subcommands 2021-09-18 08:55:40 -07:00
Alex Flint 3d59e5e89e bump go-scalar to v1.1 and add documentation about supported types 2021-08-20 19:52:48 -07:00
Alex Flint c9b504edc1 add FailSubcommand, WriteUsageForSubcommand, WriteHelpForSubcommand 2021-05-09 13:55:34 -07:00
Alex Flint 1e81bb6866 fix the mappings-with-commas example 2021-04-20 12:23:49 -07:00
Alex Flint a84487a43a updated the example for mappings with commas 2021-04-19 21:35:09 -07:00
Alex Flint fe4a138ac8 test coverage 100% !! 2021-04-19 21:03:43 -07:00
Alex Flint 57f610284f add an runnable example for mappings 2021-04-19 14:01:29 -07:00
Alex Flint c47edd0324 add documentation and examples showing how to override the short and long option names together 2020-08-06 16:41:45 -07:00
Dylan Allbee 338e831a84 Print global options in help for subcommands
fixes #101
2020-01-25 11:53:34 -08:00
Marco Molteni cfd894f446 usage: if the program supports subcommands, mention it 2020-01-19 19:40:53 +01:00
Andrew Morozko 9d4521ce8b Final improvements 2019-11-30 22:31:08 +03:00
Andrew Morozko c3a019cdb8 Various changes 2019-11-30 00:22:21 +03:00
Andrew Morozko 904e039267 Added the "dataname" tag 2019-11-29 22:33:16 +03:00
Alex Flint 7ac060af18 update documentation to new way of specifying defaults 2019-10-21 23:13:41 -07:00
Alex Flint e6003d3b6a add subcommands to readme 2019-08-06 16:41:50 -07:00
Alex Flint b83047068d print help and usage at subcommand level if necessary 2019-05-03 15:49:44 -07:00
Alex Flint 15bf383f1d add subcommands to usage string 2019-05-03 15:02:10 -07:00
Alex Flint 3392c173d7 add expected output for usage example 2019-05-03 13:07:12 -07:00
Alex Flint e2ce620ee4 add expected outputs to all examples 2019-05-03 12:56:41 -07:00
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