Commit Graph

23 Commits

Author SHA1 Message Date
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 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 b1ec8c9093 make it possible to override the name of the program 2016-01-18 10:31:01 -08:00
Alex Flint 4197d283e4 extract common colWidth constant 2016-01-18 08:24:21 -08:00
Alex Flint 77be03b907 resolve merge 2016-01-18 08:19:10 -08:00
Alex Rakoczy e4e9e19427 Fix error when printing usage for multi-value arguments
We try to compare []strings, which are uncomparable types:

`panic: runtime error: comparing uncomparable type []string`
2015-12-04 09:59:13 -05:00
Fredrik Wallgren 670c7b787d
Fix merge conflicts 2015-11-22 01:06:44 +01:00
brettlangdon d45bd4523c Display help text for positional arguments 2015-11-21 18:59:40 -05:00
Fredrik Wallgren b0d37d1fb2 Add default values to usage
Check if the value isn't it's zero value and if not add a default value
to the usage text.
2015-11-22 00:53:29 +01:00
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
Alex Flint c4704194de Merge pull request #14 from walle/usage_on_stderr_bug
Fix bug with error not being written to stderr
2015-11-11 09:34:05 -08:00
Fredrik Wallgren d6a447ed7c
Fix lint warning 2015-11-11 14:08:28 +01:00
Fredrik Wallgren df17f4df45
Fix bug with error not being written to stderr
Only the usage message was written to stderr, the error was written with
the standard fmt.Println.
2015-11-11 10:29:01 +01:00
Alex Flint a49bba8533 Merge pull request #10 from walle/fail_to_stderr
Write usage message to stderr on error
2015-11-09 10:04:37 -08:00
Fredrik Wallgren 935b2a1bd5
Write usage message to stderr on error
When the parsing of parameters/flags fails eg. when a required flag is
missing, print the usage statement and error to stderr instead of
stdout.
2015-11-09 10:27:15 +01:00
brettlangdon 383b8b84c1 Remove excess trailing whitespace from Usage generation 2015-11-07 09:39:23 -05:00
Alex Flint 9111061915 add tests for usage info 2015-11-04 09:47:58 -08:00
Alex Flint 60f2612c0c separate help into WriteUsage and WriteHelp 2015-11-01 13:53:51 -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 76293a5a72 add usage.go 2015-10-31 18:32:20 -07:00