Commit Graph

120 Commits

Author SHA1 Message Date
Kaushal Subedi
8b46886de8 added flag to have a custom text on the USAGE section of help 2015-10-24 23:37:21 -06: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
elij
db7af859d2 make help and version parsing use actual specified values
fixes #254
2015-10-13 15:20:36 -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
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
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
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
595c055010 If Version is an empty string, suppress version output in usage help. 2015-06-24 23:07:32 -07:00
Jesse Szwedko
7ad88c2740 Merge pull request #238 from polds/copyright
Add the ability to add a copyright
2015-06-16 19:39:24 -07:00
Peter Olds
4a11a6ba05 Remove whitespace #238
Signed-off-by: Peter Olds <polds@kyanicorp.com>
2015-06-16 15:23:29 -06:00
Peter Olds
2726643347 Add the ability to add a copyright
Signed-off-by: Peter Olds <polds@kyanicorp.com>
2015-06-09 16:35:50 -06:00
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).
2015-06-02 20:16:44 -07:00
Victor Vieux
7c041f5811 do not print 'AUTHOR(S):' is there is no author
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-05-03 18:01:26 -07:00
jszwedko
e842547421 Readd printHelp function back
But update signature to take a writer. This is a backwards incompatible
change for those overriding the HelpPrinter, but the hope is that this
feature is largely unused and the usage is easily updated.
2015-05-03 17:43:52 -07:00
2bcd11f863 Merge pull request #193 from codegangsta/add-aliases
Add `Command.Aliases` and deprecate `Command.ShortName`
2015-03-16 21:49:33 -04:00
陈小玉
84630daaf4 Update help.go
change template `AUTHOR(s)` tab ident to whitespace.
2015-03-14 01:12:37 +08:00
jszwedko
bf65971a6a Add Command.Aliases and deprecate Command.ShortName
`Aliases` will be more flexible while still allowing "ShortName"
behaviour via `Aliases`.
2015-03-09 21:24:57 -07:00
Jesse Szwedko
3e0905345c Merge pull request #186 from nrdufour/master
Fixing the issue with a command with subcommands not showing help message
2015-03-09 19:37:25 -07:00
Nicolas Dufour
4be878bffc Fixing the issue with a command with subcommands not showing help message.
- the command name is "" and HasName was returning true for an empty
  ShortName.
- the Show method wasn't aware that command name was just "" and
  returned the first subcommand.
2015-02-23 08:32:31 -05:00
Harrison
c6592bb487 app, help: add backwards compatibility for Authors 2015-02-21 10:44:00 +11:00
Peter Smit
5308b4cd0f Allow commands to be hidden from help and autocomplete 2015-02-06 10:46:32 +02:00
Harrison
3d7183307a app, help: add support for multiple authors 2015-01-31 10:04:52 +11:00
a14c5b47c7 Merge pull request #154 from codegangsta/allow-writer-to-be-set
Allow writer to be set
2014-12-12 08:50:46 -05:00
Jesse Szwedko
e7849f9239 Merge pull request #128 from nbjahan/patch-1
Fixed ShowSubcommandHelp
2014-12-11 20:37:53 -05:00
jszwedko
e72094e6a4 Prefer fmt.Fprint* functions over io.WriteString
Less composition needed.
2014-12-01 23:57:35 -05:00
jszwedko
b8c8282de5 Merge remote-tracking branch 'origin/master' into allow-writer-to-be-set
Conflicts:
	app.go
	help.go
2014-12-01 23:51:35 -05:00
jszwedko
0d4870d63e Rename Stdout -> Writer 2014-12-01 23:50:04 -05:00
pivaldi
59ef9567ae Fix bash completion for deep level subcommands 2014-11-19 11:05:01 +01:00
Nima Jahanshahi
4db56687fa Fixed ShowSubcommandHelp
ShowSubcommandHelp should show help for the subcommand not the app
2014-08-11 11:27:26 +04:30
Josh Mervine
120f0688a4 Merge remote-tracking branch 'parent/master'
Conflicts:
	cli_test.go
	flag_test.go
2014-08-04 11:25:45 -07:00
Jeremy Saenz
ec11175ac1 Merge pull request #123 from AudriusButkevicius/help
Additional help cleanup
2014-08-02 12:56:38 -07:00
Audrius Butkevicius
527fbe0671 Unify template formatting 2014-07-26 22:24:08 +01:00
Audrius Butkevicius
fcc1613bb5 Do not show empty description section 2014-07-26 22:23:36 +01:00
Audrius Butkevicius
e38bac8225 Print author 2014-07-26 22:03:32 +01:00
Audrius Butkevicius
bc02933ea4 Fix Subcommand help text 2014-07-13 18:51:24 +01:00
Audrius Butkevicius
d6d4e6448b Hide "Options" sections in help, if no flags are defined 2014-07-13 18:51:17 +01:00
Joshua Mervine
5821632000 Adding VersionPrinter and tests. 2014-06-17 22:26:35 -07:00
John Hopper
60e3dcaf6d Allow a writer to be set that represents Stdout so that redirection of App output may occur. 2014-06-12 02:27:15 -07:00
Jack Christensen
357921b483 Use HelpPrinter in ShowCommandHelp 2014-04-26 17:02:33 -06:00
Jeremy Saenz
5e1cde20d3 Merge pull request #75 from Winslett/command-not-found
Customizable command not found function
2014-04-22 20:33:49 -07:00
Summer Mousa
705994c2c6 Added unit tests 2014-04-16 12:59:34 -05:00
Summer Mousa
13f0c8c0f6 More consistent implementation of recursive subcommands 2014-04-16 11:18:00 -05:00
Summer Mousa
3a10545f91 Made bash completion command optional; still need to update documentation 2014-04-12 08:32:53 -05:00
Summer Mousa
0b29bee364 merging code 2014-04-10 12:14:13 -05:00
Chris Winslett
37299d4e5a Customizable command not found function 2014-03-30 20:46:02 -07:00
Tim Jarratt
58bfabca6d Add a way to override the app help printer
Fixes #64
2014-02-04 08:40:06 -08:00
Alexander Rødseth
22a56266c5 Removed the function and data structure for generating man pages 2013-11-24 14:41:42 +01:00
Alexander Rødseth
1bea6dcbf0 Custom type for arguments 2013-11-24 14:40:21 +01:00
Alexander Rødseth
7050f048d1 Added simple man page support 2013-11-15 12:40:18 +01:00
Jeremy Saenz
b25b7a883c JMS #39: Removed all calls to os.Exit(). 2013-11-01 07:33:39 -07:00
Jeremy Saenz
8cea424806 JMS #28: -h flags for subcommands 2013-08-13 21:40:39 -07:00
Jeremy Saenz
70eacca641 JMS #25: Added support for help flags 2013-07-24 07:35:45 -07:00
Jeremy Saenz
41dde0adab JMS #5: Displaying help for subcommands. Better looking help code 2013-07-20 10:46:47 -07:00
Jeremy Saenz
0dd327f6e5 JMS #5: Starting support for subcommand docs 2013-07-20 10:20:46 -07:00
Jeremy Saenz
d8cf49f0dd Printing out version numbers 2013-07-20 08:44:09 -07:00
Jeremy Saenz
580cc011fd JMS #14: More help cleanup 2013-07-19 15:23:42 -07:00
Jeremy Saenz
63b9f2823a JMS #14: Improved help. Brought help commadn back to commands 2013-07-19 15:10:34 -07:00
Jeremy Saenz
6664835bc1 JMS #14: Moving toward having and app object 2013-07-19 08:34:01 -07:00
Jeremy Saenz
3b0fc03a67 JMS #4: Support for flag handling on command line 2013-07-18 17:41:22 -07:00
Jeremy Saenz
96f806fd22 JMS #3: Passing a context struct instead of a string 2013-07-16 08:12:12 -07:00
Jeremy Saenz
921da63e2e Support for global flags in help text 2013-07-14 19:16:30 -07:00
Jeremy Saenz
16bf6d4f76 Formatting 2013-07-14 18:19:53 -07:00
Jeremy Saenz
5a624affb8 Yo dawg, I heard you liked the help command...
So I described the help command in your help command
so you can help command while you help command
2013-07-14 18:17:15 -07:00
Jeremy Saenz
bdb9c5ab61 Support for shortnames 2013-07-14 18:00:03 -07:00
Jeremy Saenz
9186f6e81a Removed error handling and cleaned up template 2013-07-14 17:53:34 -07:00
Jeremy Saenz
5b788be8a6 Formatted help text via templates 2013-07-14 17:37:43 -07:00
Jeremy Saenz
6016cafda3 Removed application object, help formatting 2013-07-14 16:30:58 -07:00