Commit Graph

50 Commits

Author SHA1 Message Date
Alex Flint af12b7cfc2 introduced path struct 2019-04-30 13:30:23 -07:00
Alex Flint 4e977796af add recursive expansion of subcommands 2019-04-30 12:54:28 -07:00
Alex Flint ddec9e9e4f rename get/settable to readable/writable 2019-04-30 11:40:11 -07:00
Alex Flint e2dda40825 all tests passing again 2019-04-14 19:50:17 -07:00
Alex Flint e86673b20a restore process as a free func 2019-04-14 18:24:59 -07:00
Alex Flint b8678d4045 refactor validation 2019-04-14 18:00:40 -07:00
Alex Flint 7b1d9ef23f simplify processing of positionals a little 2019-04-14 17:30:53 -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 75bf1a1525 Fix providing multiple values via environment variables 2018-04-26 21:10:44 +03: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 a0df5f3391 handle negative values 2018-01-13 14:20:00 -08: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
Rick fb97335a13 Allow spaces after each comma in tags 2017-09-16 12:05:53 +01:00
Mario Hros 58e62faa3d required positional args 2017-03-30 20:32:39 +02: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 c4c162448c deal with "-" as option value 2017-02-21 09:08:08 -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 ec576f9765 fix case where os.Args is empty 2017-02-09 15:12:33 -08:00
Emmanouil "Manolis" Maragkakis db27431153 add support for description string 2017-01-23 20:41:12 -05:00
Alex Flint 12fa37d10d add support for embedded structs 2016-10-10 10:48:28 +10:30
Alex Flint c453aa1a28 add support for version string 2016-09-08 21:18:19 -07:00
Alex Flint 5800b89ce9 fix example function names 2016-07-31 09:14:44 -07: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 e389d7f782 add support for IP address, email address, and MAC address 2016-01-23 20:49:57 -08:00
Alex Flint 865cc5a973 add support for pointers and TextUnmarshaler 2016-01-23 19:40:15 -08:00
Alex Flint ed2b19f2bb add support for time.Duration fields 2016-01-23 18:28:35 -08:00
brettlangdon 8dd29d34bf Add support for environment variables 2016-01-18 13:42:04 -05:00
Alex Flint b1ec8c9093 make it possible to override the name of the program 2016-01-18 10:31:01 -08:00
Alex Flint 0c0f9a53ac MustParse returns *Parser 2016-01-05 13:52:33 -08:00
Alex Flint 5db9c77fa3 Merge pull request #13 from walle/show_builtin
Add built ins to options in help output
2015-11-22 10:04:14 +10:30
Fredrik Wallgren 330a0da571
Add built ins to options in help output
Adds help to the options in help output with an easy way to add more
built ins.
2015-11-16 13:23:58 +01:00
Fredrik Wallgren ab43eae565
Move package documentation to doc.go 2015-11-11 14:16:39 +01:00
Alex Flint 70c56eff66 add more tests 2015-11-04 10:27:17 -08:00
Alex Flint 95bf6f25e0 fix first example in docs - h/t eric somerlade 2015-11-01 21:55:52 -08:00
Alex Flint 60f2612c0c separate help into WriteUsage and WriteHelp 2015-11-01 13:53:51 -08:00
Alex Flint f042ab6386 add .travis.yml 2015-11-01 13:24:35 -08:00
Alex Flint cd9f5188a8 fix example 2015-11-01 11:40:09 -08:00
Alex Flint beede9329a added runnable examples 2015-11-01 11:34:22 -08:00
Alex Flint 30befae91a move more stuff over to the parser struct 2015-11-01 00:13:23 -07:00
Alex Flint f427e9f317 added parser struct 2015-10-31 23:57:26 -07:00
Alex Flint 04e96c0c6b udpate readme 2015-10-31 18:48:38 -07:00
Alex Flint b9ad104f33 added usage generation 2015-10-31 18:26:58 -07:00
Alex Flint 8397a40f4c positional arguments working 2015-10-31 17:05:14 -07:00
Alex Flint 408290f7c2 basic first version working 2015-10-31 16:15:24 -07:00