Commit Graph

470 Commits

Author SHA1 Message Date
ston1th bb7e45acf1 Added destination scan support for flags 2015-11-14 20:01:15 +01:00
Gabe Rosenhouse 7c6caf69ef Update golang versions used by Travis CI
- current latest: 1.5.1
2015-11-13 23:47:41 -08:00
Nathan LeClaire 3323ab4460 Use a test table and add --help test
Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>
2015-10-29 20:17:12 -07:00
Jesse Szwedko 8cd49b108c Update TestCommandIgnoreFlagsIncludingFirstArgument to test for arguments 2015-10-29 20:16:35 -07:00
Jesse Szwedko 6191d931b7 When skipping flag parsing, still parse into arguments
Fool the FlagSet into thinking that all arguments are actually
arguments rather than attempting to parse them as flags.
2015-10-29 20:16:35 -07:00
Jesse Szwedko bc3cb33cef Actually skip parsing of flags if SkipFlagParsing is set
Previous just skipped if firstFlagIndex was > -1
2015-10-29 20:16:35 -07:00
Nathan LeClaire c538c376c9 Do not return error when flag parsing should be skipped
Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>
2015-10-29 20:16:35 -07:00
Jesse Szwedko 70e3fa51eb Merge pull request #292 from Jille/remove-unused-var
bash_autocomplete: Remove unused local variable prev
2015-10-29 20:11:27 -07:00
Jille Timmermans 34639643ac bash_autocomplete: Remove unused local variable prev 2015-10-28 14:39:36 +00:00
Kaushal Subedi c70ad9b688 fixed tests 2015-10-24 23:51:06 -06:00
Kaushal Subedi 8b46886de8 added flag to have a custom text on the USAGE section of help 2015-10-24 23:37:21 -06:00
Jesse Szwedko f445c89440 Merge pull request #284 from rbjorklin/readme-update
Added coverage and reference logos to README.md
2015-10-21 22:00:38 -07:00
Jesse Szwedko cffab77ecb Merge pull request #286 from mktmpio/dedup-help-and-version
only display app version and help message once
2015-10-18 17:28:50 -07:00
Ryan Graham 732e97aee8 only display app version and help message once
When processing the flags for -h/--help and -v/--version, only check
the flags in checkVersion() and checkHelp() instead of also printing
the associated message.

This fixes the problem of `app -h` and `app -v` printing their output
twice. The doubling was caused by printing the message once for each
registred alias for the given flags (-h/--help and -v/--version).

Resolves #285
2015-10-18 17:02:23 -07:00
Robin Björklin 443fff6934 Added coverage and reference logos to README.md 2015-10-18 20:32:50 +02:00
Jesse Szwedko aba9469083 Merge pull request #282 from cactus/master
make help and version parsing use actual specified values
2015-10-17 11:54:49 -07:00
elij db7af859d2 make help and version parsing use actual specified values
fixes #254
2015-10-13 15:20:36 -07:00
Jesse Szwedko 96f1fedb28 Merge pull request #281 from thiderman/patch-1
Remove 'bitchass' from README
2015-10-06 19:46:01 -07:00
Jesse Szwedko 9039757268 Merge pull request #267 from tristanz/master
Add ArgsUsage field to document the use of arguments
2015-10-06 19:45:04 -07:00
Lowe Thiderman be8ef15245 Remove 'bitchass' from README
Having needless derogatory words in the description of the project is just juvenile, and this stood out as a blemish on an otherwise pretty flawless introduction.
2015-10-06 20:17:33 +02:00
Jesse Szwedko 88df06b5e3 Merge pull request #279 from nodirt/version
Honor HideHelp and HideVersion
2015-10-05 20:26:32 -07:00
Jesse Szwedko f35cf683a8 Merge pull request #280 from gummiboll/fix-for-testcommandignoreflags
Added a flag for TestCommandIgnoreFlags
2015-10-05 20:05:46 -07:00
Emil Thelin a9585bb11c Added a flag for TestCommandIgnoreFlags 2015-10-03 17:19:04 +02:00
Nodir Turakulov c80fcac42b Honor HideHelp and HideVersion
App.Run does not check a.Hide{Help,Version} before checking it,
as a result customers cannot define their own -v flag (e.g. for verbose)
2015-09-27 23:42:17 -07:00
Jesse Szwedko a65b733b30 Merge pull request #275 from langri-sha/master
Improve formatting
2015-09-08 18:48:53 -07:00
Filip Dupanović 4ad8f298e2 Improve formatting 2015-09-08 11:00:04 +02:00
Jesse Szwedko eaad6fe6bc Merge pull request #274 from klueska/bash-completion-default-prog
Set default PROG in bash_autocomplete
2015-09-05 14:07:14 -07:00
Kevin Klues 543102d9c3 Set default PROG in bash_autocomplete
By setting the default value of PROG to the basname of whatever the
filename is, we allow bash_autocomplete to be copied into
/etc/bash_completion.d without modification.
2015-08-28 18:25:37 -07:00
Tristan Zajonc c7aac252f1 add tests 2015-08-12 22:14:26 -07:00
Tristan Zajonc cc46ca1020 allow overriding help name 2015-08-12 21:58:25 -07:00
Tristan Zajonc aced6e8739 fix tests 2015-08-12 21:43:14 -07:00
Tristan Zajonc ecb0b5ac0a improve help by including parent command for subcommands 2015-08-12 20:00:07 -07:00
Tristan Zajonc ef65245544 add ArgsUsage to App and Command 2015-08-12 20:00:07 -07:00
Jesse Szwedko 142e6cd241 Merge pull request #264 from wardn/master
Improve vendoring options by removing self-referential imports in tests.
2015-08-11 21:22:59 -07:00
Tarcísio Gruppi 1510d7e722 Updated tests to support exit code 2015-07-28 20:29:13 +02:00
Tarcísio Gruppi b79f884410 Updated README.md with exit code sample 2015-07-28 20:10:13 +02:00
Tarcísio Gruppi 49c1229409 Added exit code support
Now the exit code can be returned by BeforeFn, ActionFn and AfterFn.

The `os.Exit` function is not called by this packaged

This closes #66 and closes #164
2015-07-28 20:10:08 +02:00
Tarcísio Gruppi 9c0db3f4ac Created types for functions
The function used by BashComplete, Before, After, Action and
CommandNotFound have their won type.

This makes easier to change/update the API
2015-07-28 20:02:18 +02:00
Edward Sheffler III 8ea1232ede Improve vendoring options by removing self-referential imports in tests. 2015-07-20 12:28:51 -07:00
Jesse Szwedko bca61c476e Merge pull request #246 from cpuguy83/propigate_cmd_parent_to_app_setup
Sets a subcommand's parent cmd
2015-07-11 14:54:04 -07:00
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>
2015-07-02 14:47:49 -04:00
Jesse Szwedko f9982619cc Merge pull request #251 from MartyMacGyver/more-cleanups
More cleanups
2015-06-30 20:15:21 -07:00
Jesse Szwedko b6d983e02c Merge pull request #253 from databus23/fix-isssue-252
Fix global flags processing on top level
2015-06-29 21:01:06 -07:00
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
2015-06-29 23:20:27 +02:00
Martin Falatic 8cae4991af Fixing more formatting 2015-06-25 02:17:26 -07:00
Martin Falatic 4d3820c145 If there are no commands, don't show Commands section. Also fixed Copyright section formatting. 2015-06-25 01:30:54 -07:00
Martin Falatic dbde3303cf Test updated 2015-06-24 23:11:59 -07:00
Martin Falatic 595c055010 If Version is an empty string, suppress version output in usage help. 2015-06-24 23:07:32 -07:00
Martin Falatic ee2cde7a77 Print blank lines in help and error outputs more consistently. 2015-06-24 22:46:33 -07:00
Jesse Szwedko ad480243a8 Merge pull request #245 from cpuguy83/get_parent_ctx
Add func to get context parent
2015-06-20 11:34:02 -07:00