Commit Graph

126 Commits

Author SHA1 Message Date
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
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
Jesse Szwedko
61db37e7ae Merge branch 'master' into default-writer 2016-10-29 18:36:19 -07:00
Jesse Szwedko
f614c177b7 Merge pull request #543 from wking/app-description
app: Add App.Description
2016-10-25 21:54:02 -07:00
W. Trevor King
3c2bce5807 help: Cleanup AppHelpTemplate trailing whitespace
Most of the changes here remove trailing whitespace, but I also add
code to select "AUTHOR" or "AUTHORS" as appropriate instead of the
previous "AUTHOR(S)".  The template for listing with an entry per line
is:

   {{range $index, $entry := pipeline}}{{if $index}}
   {{end}}{{$entry}}{{end}}

That range syntax is discussed in [1].

Also add a unit test, which tests both these whitespace changes and
also the earlier App.Description addition.

[1]: https://golang.org/pkg/text/template/#hdr-Variables
2016-10-22 16:02:21 -07:00
Richard Kovacs
4cc2bad36e Display error instead of just say command is incorrect 2016-10-19 13:31:05 +02:00
Jesse Szwedko
508a23430b Default app.Writer to os.Stdout
As NewApp() does.

Fixes #545
2016-10-18 20:56:31 -07:00
Dan Buch
363d9c9a31
Add a hack so that zsh completion only runs for zsh 2016-07-24 17:29:13 -04:00
Dan Buch
dd253d122c
Write err to stderr, exit 1 if err != ""
Closes #475
2016-07-24 11:57:51 -04:00
Jesse Szwedko
65da20beab Correctly show help message if -h is provided to subcommand
Currently, if an action is specified on a subcommand, it ignores the
`-h` and `--help` flags if passed to the subcommand, e.g.:

`foo bar -h`

would call the default action on `bar` rather than show the help
documentation.

Fixes #477
2016-07-13 14:48:16 -07:00
Dan Buch
3c5afd4757
Hide help command for category tests 2016-06-22 09:48:39 -04:00
Dan Buch
5a3515fdf8
Focus on catching fewer panics in HandleAction
so that "unknown" panics can still bubble up.
2016-06-09 17:32:00 -04:00
Matt Farina
2f4ec31264 Fixed spelling and gofmt issues 2016-05-09 09:40:09 -04:00
Dan Buch
dfa9a87bee
Add tests for App.VisibleCategories & App.VisibleCommands 2016-05-08 23:54:12 -04:00
Dan Buch
cc481d6b0e
Adjust command hiding to use similar convention as hidden flags
plus breaking out "setup" portion of `App.Run` into its own method, cleaning up
some bits of the help templates, and allowing for runtime opt-in of displaying
template errors to stderr.
2016-05-03 06:54:05 -04:00
Dan Buch
4cae17cfe1
Ensure MultiError returned when both Before and After funcs given 2016-04-28 17:15:16 -04:00
Dan Buch
61d4175525
Merge remote-tracking branch 'origin/master' into txgruppi-develop 2016-04-28 16:20:02 -04:00