Commit Graph

323 Commits

Author SHA1 Message Date
Alex Flint b1eda2c7b6
Merge pull request #62 from mwlazlo-tls/master
Custom parsers implementing encoding.TextMarshaler() can have default…
2018-04-15 18:34:32 -07:00
Wlazlo, Matt 51337ded77 fixed example comment, test coverage issue 2018-04-16 11:07:48 +10:00
Wlazlo, Matt d4cc703210 Custom parsers implementing encoding.TextMarshaler() can have default values printed via --help 2018-04-13 14:46:24 +10:00
Alex Flint 0cc8e30fd6
Merge pull request #61 from alexflint/negative-values
handle negative values
2018-02-05 10:02:42 -08:00
Alex Flint a0df5f3391 handle negative values 2018-01-13 14:20:00 -08:00
Alex Flint 59fccacb26 Merge pull request #59 from rickb777/master
Altered help tag parsing to allow comma and colon
2017-10-02 17:07:17 -07:00
Rick ba9514f0be Further clarification 2017-10-02 14:36:23 +01:00
Rick d7961941f0 Altered help tag parsing to reduce the constraints on help text content; old behaviour is retained for backward compatibility 2017-10-02 14:18:41 +01:00
Alex Flint 398a01ebab Merge pull request #57 from rickb777/master
Allow spaces after each comma in tags
2017-09-27 14:56:33 -07:00
Rick fb97335a13 Allow spaces after each comma in tags 2017-09-16 12:05:53 +01:00
Alex Flint cef6506c97 Merge pull request #54 from k3a/master
Required multiple positionals
2017-03-30 14:10:29 -07:00
Mario Hros 992acaf408 tests 2017-03-30 20:47:59 +02:00
Mario Hros 58e62faa3d required positional args 2017-03-30 20:32:39 +02:00
Alex Flint 8111804d17 Merge pull request #53 from k3a/master
Make usage output nicer
2017-03-09 21:49:31 -08:00
K3A b413f8dfb0 Merge branch 'master' into master 2017-03-09 18:25:56 +01:00
Alex Flint e6e0f59a17 Merge pull request #50 from kenshaw/add-single-notrunc-opts
Adding single and notrunc tag options
2017-03-08 21:22:53 -08:00
Mario Hros 9e6f80aa90 readme update 2017-03-08 20:52:02 +01:00
Mario Hros 9173d259ef nicer usage output 2017-03-08 20:44:01 +01: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 8488cf10ce Merge pull request #48 from alexflint/parse_hyphen
deal with "-" as option value
2017-02-22 08:38:08 -08:00
Alex Flint c4c162448c deal with "-" as option value 2017-02-21 09:08:08 -08:00
Alex Flint 2c249ee1fc Merge pull request #46 from alexflint/vendoring
vendor in dependencies
2017-02-17 20:57:21 -08:00
Alex Flint 44a8b85d82 deal with booleans correctly 2017-02-15 18:37:19 -08:00
Alex Flint 38c51f4cab put comment back 2017-02-15 18:24:32 -08:00
Alex Flint 6859799559 use go-scalar, vendoring 2017-02-15 18:19:41 -08:00
Alex Flint 765ccf7459 Merge pull request #45 from alexflint/empty_args
Do not crash when os.Args is empty
2017-02-09 19:34:18 -08:00
Alex Flint ec576f9765 fix case where os.Args is empty 2017-02-09 15:12:33 -08:00
Alex Flint b658405f70 Merge pull request #43 from mnsmar/master
print description in help message, not in usage
2017-02-09 10:16:44 -08:00
Emmanouil "Manolis" Maragkakis 9030aa1348 print description in help message, not in usage 2017-02-08 11:41:07 -05:00
Alex Flint bf73829f30 Merge pull request #41 from mnsmar/master
add support for description string
2017-01-24 08:29:43 -08:00
Emmanouil "Manolis" Maragkakis db27431153 add support for description string 2017-01-23 20:41:12 -05:00
Alex Flint 7c77c70f85 Merge pull request #39 from alexflint/embedded
add support for embedded structs
2016-10-11 09:09:17 +10:30
Alex Flint 03900620e2 add not on embedding to readme 2016-10-10 10:52:42 +10:30
Alex Flint 12fa37d10d add support for embedded structs 2016-10-10 10:48:28 +10:30
Alex Flint e6fdb157e9 Merge pull request #38 from alexflint/version_string
Add support for version strings
2016-09-13 18:47:19 -07:00
Alex Flint f882700b72 add to readme 2016-09-08 21:26:12 -07:00
Alex Flint c453aa1a28 add support for version string 2016-09-08 21:18:19 -07:00
Alex Flint 34954f45ce Merge pull request #36 from alexflint/add_goreportcard_readme
Add goreportcard to README.md
2016-07-31 10:18:40 -07:00
Alex Flint 6e9648cac6 add goreportcard to readme.md 2016-07-31 10:16:17 -07:00
Alex Flint a5617823b0 Merge pull request #35 from alexflint/fix_example_names
fix example function names
2016-07-31 09:21:49 -07:00
Alex Flint 5800b89ce9 fix example function names 2016-07-31 09:14:44 -07:00
Alex Flint 34b52501bd Merge pull request #34 from walle/defaults_for_multiple
Print defaults for multiples
2016-03-06 12:44:34 -08:00
Fredrik Wallgren e71d6514f4
Print defaults for multiples
Check if the default value supplied is a slice and not nil, if so
print the list of values supplied.
Test case for slice argument with and without default values.
Default values for slices was not printed because slice is not
comparable, but the zero value for slices is nil.
2016-03-06 21:07:01 +01:00
Alex Flint 45474a9b25 Merge pull request #33 from walle/multiple
Defaults for multiples, intended behaviour
2016-03-04 09:35:36 -08:00
Fredrik Wallgren 1488562b1e
Allow override of defaults for slice arguments
This commit fixes a bug where if a multiple value argument (slice) has default
values, the submitted values will be appended to the default. Not
overriding them as expected.
2016-02-29 22:05:26 +01:00
Alex Flint aaae1550b7 Merge pull request #32 from alexflint/override_program_name
make it possible to override the name of the program
2016-02-22 06:39:41 -08:00
Alex Flint 77dd0df006 Merge pull request #31 from alexflint/parse_ip_mac_and_email
Parse IP addresses, MAC addresses, and email addresses
2016-01-23 21:07:42 -08:00
Alex Flint a1c72f6aa9 Merge remote-tracking branch 'origin/master' into parse_ip_mac_and_email 2016-01-23 21:03:51 -08:00
Alex Flint c0809e537f Merge pull request #30 from alexflint/scalar_pointers
add support for pointers and TextUnmarshaler
2016-01-23 21:03:39 -08:00
Alex Flint c9584269b9 added tests for MAC and email addresses 2016-01-23 20:58:43 -08:00