Commit Graph

104 Commits

Author SHA1 Message Date
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
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
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
ee2cde7a77 Print blank lines in help and error outputs more consistently. 2015-06-24 22:46:33 -07:00
Fabian Ruff
65d50017d4 search context hierachy for global flags 2015-05-18 23:21:33 +02:00
jszwedko
a889873af5 Set additional information on command's 'app'
For completeness
2015-05-03 18:42:21 -07:00
jszwedko
b8104e5da7 Set writer when running command as app
Also add test from https://github.com/codegangsta/cli/pull/202 with
slight modifications.
2015-05-03 18:37:51 -07: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
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
jszwedko
50c77ecec0 Fix comments for .After field on Command and App 2015-02-20 16:23:36 -05:00
Peter Smit
5308b4cd0f Allow commands to be hidden from help and autocomplete 2015-02-06 10:46:32 +02:00
Dario Castañé
4e3a83b43e Merge branch 'master' of https://github.com/codegangsta/cli
Conflicts:
	app.go
	app_test.go
2015-01-10 00:35:11 +01:00
Jesse Szwedko
bf4a526f48 Merge pull request #157 from dajulia3/pull_request
stop flag parsing after terminator --
2015-01-09 14:04:33 -05:00
5b9e204508 Merge pull request #153 from codegangsta/allow-hiding-of-help-flag
Allow hiding of help flag without hiding help subcommand
2015-01-08 14:49:36 -05:00
Matthew McNew
d05d895492 stop flag parsing after terminator --
Signed-off-by: David Wadden <dwadden@pivotal.io>
2014-12-17 09:56:05 -06: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
jszwedko
780f839a02 Allow hiding of help flag without hiding help subcommand
By utilizing struct zero value
2014-12-01 23:21:22 -05:00
Dario Castañé
44efc2952d Added Before method to command and app 2014-11-18 23:44:21 +01:00
Kyle Allan
156cd267e5 move to CommandNotFound copy to startApp 2014-07-25 10:06:04 -07:00
Audrius Butkevicius
4a645835f0 Add HideHelp flag in App and Command 2014-07-13 18:51:09 +01: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
Summer Mousa
a911ec75e4 Can now change these default flags in other applications 2014-04-29 09:21:19 -05:00
Jeremy Saenz
73aae5979c Merge pull request #80 from wendorf/master
Add SkipFlagParsing option to Command
2014-04-22 20:34:36 -07:00
Jeremy Saenz
a502865bb7 Merge pull request #74 from Winslett/context-accessible-command
Make Command accessible from Context
2014-04-22 20:33:02 -07:00
Summer Mousa
2535376782 If the Subcommand is instantiated, via the Before method and has no subcommands, display the CommandHelp instead of the SubcommandHelp 2014-04-17 11:48:00 -05:00
Summer Mousa
faf2a3d4a3 Added Before method to command. If set, or if command.Subcommands is set, then the command is treated as a recursive subcommand 2014-04-16 15:26:28 -05:00
Summer Mousa
13f0c8c0f6 More consistent implementation of recursive subcommands 2014-04-16 11:18:00 -05:00
Dan Wendorf and Karen Wang
6c5f810d8f Add SkipFlagParsing option to Command 2014-04-14 14:44:32 -07: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
c69522c960 Make Command accessible from Context 2014-03-29 12:02:05 -07:00
Jeremy Saenz
01b889e637 Merge branch 'master' of github.com:xyproto/cli into xyproto-master
Conflicts:
	app.go
	context.go
2013-11-28 07:51:31 -08:00
Alexander Rødseth
1bea6dcbf0 Custom type for arguments 2013-11-24 14:40:21 +01:00
Jeremy Saenz
ab6f1b7c3c Formatting 2013-11-20 17:25:13 -08:00
Jeremy Saenz
4120b604ec Removed help flag. we no longer need it. 2013-11-20 17:24:37 -08:00
Jared Forsyth
dc8a62e0e9 refactor, more robust flag propagation 2013-11-20 01:05:18 -07:00
Alexander Rødseth
f93652a890 Fixed all problems/warnings reported by "go vet" 2013-11-15 11:35:24 +01:00
Jeremy Saenz
b25b7a883c JMS #39: Removed all calls to os.Exit(). 2013-11-01 07:33:39 -07:00
Jeremy Saenz
0d3c3f4497 Improved documentation 2013-11-01 07:31:37 -07:00
Thesyncim
4d9038a156 add ability to parse []string types 2013-09-24 02:41:31 +01:00
Damien Le Berrigaud
5d511c7a8b Allow for flags being passed in after arguments 2013-09-18 10:37:03 -06:00
Casey McTaggart
3e07cbd8ba Show usage and exit with error whenever arguments parsing fails
Signed-off-by: Damien Le Berrigaud <damien@pivotallabs.com>
2013-09-04 13:58:31 -06:00
Jeremy Saenz
8cea424806 JMS #28: -h flags for subcommands 2013-08-13 21:40:39 -07:00
Jeremy Saenz
ed1ee94250 Adding some docs 2013-07-20 15:50:13 -07:00
Jeremy Saenz
04490dabec Minor tweaks and cleanup 2013-07-20 08:21:20 -07:00
Jeremy Saenz
6664835bc1 JMS #14: Moving toward having and app object 2013-07-19 08:34:01 -07:00
Jeremy Saenz
c15c42a7a8 JMS #4: Command.HasName 2013-07-18 19:30:18 -07:00
Jeremy Saenz
4495e2e996 JMS #4: Delegating to Command.Run 2013-07-18 19:23:00 -07:00
Jeremy Saenz
3f76896c4f JMS #4: Getting some cli tests going. Testing out flags 2013-07-18 17:41:22 -07:00