Commit Graph

289 Commits

Author SHA1 Message Date
Alex Flint d615e5c1d8 drop godeps 2018-11-20 12:07:45 -08:00
Alex Flint fb7d95b61b
Merge pull request #69 from pborzenkov/update-go-scalar
Update go scalar to the latest version
2018-11-20 10:45:00 -08:00
Pavel Borzenkov a6af419fff README: update TextUnmarshaler example
Values are much more convenient to use in argument structs, so update
README to use them instead of pointers in the example as we now support
this.

Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
2018-11-20 12:32:32 +03:00
Pavel Borzenkov f1aabd5026 parse_test: add tests covering new TextUnamarshaler value support
Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
2018-11-20 12:29:36 +03:00
Pavel Borzenkov 96b097bef3 parse_test: fix formatting
Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
2018-11-20 12:29:15 +03:00
Pavel Borzenkov 5225bc2f3c vendor: update go-scalar to the latest version
Allows to use values (not pointer) with custom TextUnmarshaler.

Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
2018-11-20 12:18:45 +03:00
Alex Flint f7c0423bd1
Merge pull request #65 from illia-v/env_multiple_values
Fix providing multiple values via environment variables
2018-05-16 11:24:05 -07:00
Illia Volochii 89714b6f48 Fix the problem with errors 2018-05-14 22:18:05 +03:00
Illia Volochii fa5fe315f8 Change format from JSON to CSV 2018-05-01 12:02:44 +03:00
Illia Volochii 488fd7e82a Add one more test 2018-04-26 21:39:48 +03:00
Illia Volochii 75bf1a1525 Fix providing multiple values via environment variables 2018-04-26 21:10:44 +03:00
Alex Flint 074ee5f759
Merge pull request #64 from alexflint/repeated-unmarshaltext
Fix repeated arguments implementing TextUnmarshaler
2018-04-20 07:57:08 -07:00
Alex Flint 4d71204936 add positional test 2018-04-18 21:54:27 -07:00
Alex Flint b9375a2e66 fix repeated text unmarshal bug 2018-04-18 21:51:16 -07:00
Alex Flint 74dd5a2c5a separate scalar.CanParse from isBoolean 2018-04-18 21:33:46 -07:00
Alex Flint 6f2f3b4bf6 drop setScalar 2018-04-18 21:23:08 -07:00
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