Commit Graph

141 Commits

Author SHA1 Message Date
Robert Liebowitz
06e3d38d88 Avoid panic for missing flag value
Currently, in cases where a flag value is required but not passed and
short-option handling is enabled, a panic will occur due to a nil
pointer dereference. This prevents that situation from occurring,
instead propagating the appropriate error.
2019-09-13 06:11:09 -04:00
FaranIdo
08c24e22ed add missing ExitErrHandler in command + matching test, fixing #816 2019-08-12 00:29:46 +03:00
Ajitem Sahasrabuddhe
aed704a9d0
Merge branch 'master' into lint-fixes 2019-08-08 14:44:02 +05:30
Ajitem Sahasrabuddhe
0990ca2391
Merge branch 'master' into lint-fixes 2019-08-08 13:36:30 +05:30
Ajitem Sahasrabuddhe
286133fee5
Merge branch 'master' into combined 2019-08-08 13:33:32 +05:30
Ajitem Sahasrabuddhe
fdba7e0f8c
linter fixes
code cleanup
changing some test code to ensure uniformity
2019-08-07 20:14:50 +05:30
Sascha Grunert
40d4a25a01
Add markdown and man page docs generation methods
This adds two new methods to the `App` struct:

- `ToMarkdown`: creates a markdown documentation string
- `ToMan`: creates a man page string

Signed-off-by: Sascha Grunert <mail@saschagrunert.de>
2019-08-07 14:02:28 +02:00
Robert Liebowitz
a77c440b84
Merge branch 'master' into combined 2019-08-06 22:33:49 -04:00
Yogesh Lonkar
2be2bc755e
Add additional test for log flag completion and comments 2019-08-05 20:18:08 +02:00
Robert Liebowitz
03153b9cf8 Allow combining short flags globally 2019-08-05 06:38:23 -04:00
Yogesh Lonkar
11c9e598b0
Merge branch 'master' into master 2019-08-03 15:52:08 +02:00
Lynn Cyrin
330a9143fb
Merge branch 'master' into fix-help-indentation 2019-08-02 18:14:50 -07:00
Yogesh Lonkar
01ab016427
Merge branch 'master' into master 2019-08-02 22:03:55 +02:00
Lynn Cyrin
60fb297232
remove help assertion stuff 2019-08-01 23:27:38 -07:00
Lynn Cyrin
fdd4d10691
update comments 2019-08-01 21:48:52 -07:00
Lynn Cyrin
ef9acb4a3b
rename cases 2019-08-01 21:46:56 -07:00
Lynn Cyrin
45f2b3d8e7
more test cases 2019-08-01 21:45:11 -07:00
Lynn Cyrin
78db152323
add typed error assertions 2019-08-01 21:35:15 -07:00
Lynn Cyrin
d4740d10d0
more test cases 2019-08-01 20:58:08 -07:00
Lynn Cyrin
595382c509
expand test cases 2019-08-01 20:39:37 -07:00
Lynn Cyrin
3d6eec825a
add test cases 2019-08-01 20:35:23 -07:00
Lynn Cyrin
7b9e16b6b5
update test names 2019-08-01 20:30:43 -07:00
Lynn Cyrin
95d3a8624d
update test to reflect app flag usage 2019-08-01 20:27:51 -07:00
Lynn Cyrin
9438aba3b8
remove showFlagError, we can use the help printer assertion to accomplish the same goal 2019-08-01 19:54:57 -07:00
Lynn Cyrin
23f09ac1e8
cleanup tests, check required flags in more places 2019-07-28 22:19:35 -07:00
Lynn Cyrin
2299852c3c
cleanup subcommand and specs 2019-07-18 00:47:18 -07:00
Lynn Cyrin
300288670f
add subcommand 2019-07-18 00:20:32 -07:00
Lynn Cyrin
cc1cf8c459
wording shift 2019-07-18 00:14:03 -07:00
Lynn Cyrin
f00f35ce8c
docs 2019-07-13 14:02:45 -07:00
Lynn Cyrin
17108e1db4
tabs 2019-07-13 13:59:29 -07:00
Lynn Cyrin
cf824804c2
update tests 2019-07-13 13:57:06 -07:00
Lynn Cyrin
80d7e91191
fill out test cases 2019-07-13 03:51:26 -07:00
Lynn Cyrin
746866c10d
add update integration with the help output 2019-07-13 03:44:39 -07:00
Yogesh Lonkar
1d7a2b08d6 Add default completion on commands, test cases, refactor code 2019-03-21 13:01:48 +05:30
mingrammer
a0453b2200 Fix the unaligned indents for the commands that have no categories 2019-03-06 23:51:22 +09:00
5fc8124af1
Merge branch 'master' into merging-jereksel-zsh 2018-02-24 21:58:26 -05:00
Nico Windler
3a87b13b01 Fix args reordering when bool flags are present 2018-02-10 14:00:34 +01:00
Tyler Davis
40263f4d6a Merge branch 'master' into master 2017-10-13 12:05:14 -07:00
Sebastian Sprenger
c3cc74dac7 fix ineffective assigns 2017-10-06 07:28:43 +02:00
688c5a9d4f Merge branch 'master' into merging-jereksel-zsh 2017-08-03 14:38:20 -04:00
Tyler Davis
5d528e2052 use exit errors in uts 2017-06-28 13:04:09 -07:00
Tyler Davis
58450552ee Add Test 2017-06-28 12:52:50 -07:00
Joe Richey joerichey@google.com
1794792adf Add ability to use custom Flag types
Users can now use custom flags types (conforming to the Flag interface)
in their applications. They can also use custom flags for the three
global flags (Help, Version, bash completion).
2017-05-05 22:24:14 -07:00
7250c97913 Merge branch 'master' into merging-jereksel-zsh 2016-12-21 15:11:00 -05:00
Kasey Klipsch
8fa549846e #556 broke the api for users who were using the ActionFunc 2016-11-21 09:47:23 -06:00
Joshua Rubin
2da42640ad
Merge remote-tracking branch 'origin/master' into completion_fix 2016-11-18 09:28:39 -07:00
Joshua Rubin
3272baf434
add a test for shell completion using incomplete flags 2016-11-14 10:10:51 -07:00
Jesse Szwedko
e367fafa3d Return an error when parsing environment variables for values fails
Currently cli silently (aside from IntSlice and Int64Slice which oddly
printed directly to the error stream) ignores failures that occur when
parsing environment variables for their value for flags that define
environment variables. Instead, we should propogate up the error to the
user.

This is accomplished in a backwards compatible manner by adding a new,
internal, interface which defines an applyWithError function that all
flags here define. In v2, when we can modify the interface, we can drop
this secondary interface and modify `Apply` to return an error.
2016-11-13 14:59:35 -08:00
Jesse Szwedko
0113f56d10 If no action is specified on the command or app, print the help documentation
Rather than panic'ing or displaying an opaque error message about the
signature which is more confusing to the end user.

Fixes #562
2016-11-12 13:37:07 -08:00
Jesse Szwedko
b377b5d9e9 Use type assertions rather than reflection to determine how to call the Action
This has some benefits, but results in possibly less informative error
messaging; however, given that there are only two accepted types,
I think the error messaging is sufficient.
2016-11-01 20:33:12 -07:00