Dan Buch
f7b2b93ffa
Merge remote-tracking branch 'origin/v1' into merging-from-v1
8 years ago
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
8 years ago
Dan Buch
99621d571e
Merge remote-tracking branch 'origin/v2' into declarativeness
8 years ago
Dan Buch
df685fbacc
Remove `NewApp` initializer
...
and move defaulting to `App.Setup`
8 years ago
Dan Buch
0f135b318e
Merge remote-tracking branch 'origin/v1' into merging-from-v1
8 years ago
Dan Buch
3c5afd4757
Hide help command for category tests
8 years ago
Dan Buch
5a3515fdf8
Focus on catching fewer panics in HandleAction
...
so that "unknown" panics can still bubble up.
8 years ago
Dan Buch
3d75e9e711
Go with interfaces + private opaque types
...
rather than public types that wrap slices
8 years ago
Dan Buch
61710ff108
Make slice wrapping pattern more consistent
...
and move *Args out into its own file
8 years ago
Dan Buch
cd10b49473
Minimize struct copying
...
by using pointer func receivers and slices of struct pointers where possible.
8 years ago
Dan Buch
c19dbaf230
Remove deprecated things and supporting code
8 years ago
Dan Buch
32ebecfbb5
Merge remote-tracking branch 'origin/master' into v2
8 years ago
Matt Farina
2f4ec31264
Fixed spelling and gofmt issues
8 years ago
Dan Buch
bac790c819
Merge remote-tracking branch 'origin/master' into v2
8 years ago
Dan Buch
dfa9a87bee
Add tests for App.VisibleCategories & App.VisibleCommands
8 years ago
Jesse Szwedko
f585ec7cb8
Remove reordering of flags and arguments
...
This was introduced by #36 , but only worked in the specific case of all
arguments being passed before all flags. If the user mixed them, they
ended up with odd parsing behavior where the arguments were reordered
(causing #103 and #355 ).
Given the tradeoffs I think we should remove support for flag
reordering.
Fixes #103
Fixes #355
8 years ago
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.
9 years ago
Dan Buch
1fb52b3bce
Merge remote-tracking branch 'origin/master' into string-slice-flag-default-160
9 years ago
Dan Buch
4cae17cfe1
Ensure MultiError returned when both Before and After funcs given
9 years ago
Dan Buch
ee736e063a
Merge remote-tracking branch 'origin/master' into string-slice-flag-default-160
9 years ago
Dan Buch
61d4175525
Merge remote-tracking branch 'origin/master' into txgruppi-develop
9 years ago
Dan Buch
2c0e13ecf8
Revising/adding tests that assert order of operations inside App.Run
9 years ago
Dan Buch
b453bf5940
Clarifying errors returned from HandleAction + tests
9 years ago
Dan Buch
b7329f4968
Switch from multi-return with exit codes to ExitCoder check
9 years ago
Dan Buch
10c8309d84
Merge branch 'develop' of https://github.com/txgruppi/cli into txgruppi-develop
9 years ago
Dan Buch
cb433e7468
Use NewIntSlice and NewStringSlice internally
9 years ago
Jesse Szwedko
042842b819
Remove CategorizedHelp from App and allow subcommands to have categories
...
Just place all subcommands in categories, the default category will be
"" which will properly format the output (and group commands that have
no category).
Also allow subcommands to have categories.
Lastly, augment the test to check the output.
9 years ago
Soulou
d0997e8f99
Set Categories as a read-only method and fix tests
9 years ago
adamclerk
cde8418658
Fixes spelling issues and import alphabetical issues
...
Using goreportcard.com I noticed a few spelling errors. I really love codegangsta/cli
and wanted to help improve it.
9 years ago
Jesse Szwedko
d5f087da9d
Merge pull request #289 from KSubedi/master
...
Added command to have a custom text on the USAGE section of help
9 years ago
Gregor Noczinski
c462071a52
* Added ability to customize usage error messages
9 years ago
Andreas Kupries
bb4e78eb6a
Fixed mishandling of a "-"(dash)-argument causing reordering of cli non-flag arguments.
...
Added test demonstrating issue (PASS with fix, FAIL without).
9 years ago
Gregor Noczinski
f90cd56647
Handle Before and After of Command without handling it as subCommand if there is no subCommand.
9 years ago
Håvard Haugen
7b94fd3aad
test: avoid output from "go test" when tests pass
...
Some tests where printing to os.Stdout as a side effect even if the
output was not used/checked in the test.
9 years ago
Jesse Szwedko
4fc241fb17
Update examples to use correct naming convention
...
See https://golang.org/pkg/testing/#hdr-Examples
9 years ago
Kaushal Subedi
c70ad9b688
fixed tests
9 years ago
Tristan Zajonc
c7aac252f1
add tests
9 years ago
Tristan Zajonc
aced6e8739
fix tests
9 years ago
Tarcísio Gruppi
1510d7e722
Updated tests to support exit code
9 years ago
Edward Sheffler III
8ea1232ede
Improve vendoring options by removing self-referential imports in tests.
9 years ago
Brian Goff
758ad1e836
Sets a subcommand's parent cmd
...
This allows the help output to show the correct/full command path to the
subcommand.
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
9 years ago
Fabian Ruff
a2d4ae5939
Fix global flags processing on top level
...
This fixes a regression introduced by #227 . When looking up global flags by walking up the parent context's we need to consider the special case when we are starting at the very top and there is no parent context to start the traversal.
Fixes #252
9 years ago
Dan Buch
4407569431
Merge branch 'master' into fix-231
9 years ago
Jesse Szwedko
55b8924c2b
Merge pull request #230 from codegangsta/do-not-swallow-after-error
...
Aggregate errors from Before/After
9 years ago
Jesse Szwedko
2272dad83e
Version and help check should look for local flags too
...
Now that Global looks up the chain of contexts, the top level should
access the flags without the prefix (i.e. Bool rather than GlobalBool).
9 years ago
Jesse Szwedko
854c52192c
Merge pull request #227 from databus23/global-flags-from-all-parents
...
Collect global flags from the full command hierarchy
9 years ago
Jesse Szwedko
7ed7a51f86
Aggregate errors from Before/After
...
Previously `After` would overwrite any error from `Before`.
9 years ago
Sergey Romanov
f47f7b7e85
Fix panic if Valus in Int/StringSliceFlasg is missing
9 years ago
Fabian Ruff
65d50017d4
search context hierachy for global flags
9 years ago
jszwedko
b8104e5da7
Set writer when running command as app
...
Also add test from https://github.com/codegangsta/cli/pull/202 with
slight modifications.
10 years ago