Commit Graph

116 Commits

Author SHA1 Message Date
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
Martin Falatic
ee2cde7a77 Print blank lines in help and error outputs more consistently. 2015-06-24 22:46:33 -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
Mawueli Kofi Adzoe
c7be972e81 Fix tiny typo. 2015-06-11 10:24:06 +00: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
55b8924c2b Merge pull request #230 from codegangsta/do-not-swallow-after-error
Aggregate errors from Before/After
2015-06-02 20:29:44 -07:00
Jesse Szwedko
7ed7a51f86 Aggregate errors from Before/After
Previously `After` would overwrite any error from `Before`.
2015-06-01 21:14:53 -07:00
Fabian Ruff
65d50017d4 search context hierachy for global flags 2015-05-18 23:21:33 +02: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
jszwedko
b95607c608 Use named struct fields 2015-03-10 08:13:31 -07:00
jszwedko
7beac44ab1 Don't default authors 2015-03-10 08:03:05 -07:00
jszwedko
5f95a9e88b Fix support for deprecated author fields
Should add an author if either name or email is specified.
2015-03-10 07:59:59 -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
jszwedko
01cdaa065a Merge remote-tracking branch 'origin/master' into add-multi-author-support
Conflicts:
	app.go
2015-03-09 19:20:56 -07:00
Harrison
c6592bb487 app, help: add backwards compatibility for Authors 2015-02-21 10:44:00 +11:00
jszwedko
50c77ecec0 Fix comments for .After field on Command and App 2015-02-20 16:23:36 -05:00
Jesse Szwedko
532d0bc2e3 Merge pull request #151 from imdario/master
After: companion action for Before
2015-02-20 16:20:12 -05:00
Harrison
3d7183307a app, help: add support for multiple authors 2015-01-31 10:04:52 +11:00
Dario Castañé
dca177c384 After handler brought up to speed.
As discussed in issue #151, I modified the implementation to be simpler.
I checked how to propagate err, being done with a scope trick. From our
deferred function we cannot return a new value, so we override the "default"
return value (err), declared on functions' declarations.

Check this StackOverflow for more info: http://stackoverflow.com/a/19934989
2015-01-10 00:51:06 +01:00
Dario Castañé
4ab12cd639 jszwedko's suggestion done 2015-01-10 00:44:37 +01: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
jszwedko
5159b98cbc Use parsed context when running command as subcommnd
Rather than passing the unparsed context (parent context) in whenever
there are no subcommands.
2015-01-09 14:46:29 -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
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ñé
3c4b583fee Action error shadowing avoided on After 2014-11-18 23:54:27 +01:00
Dario Castañé
44efc2952d Added Before method to command and app 2014-11-18 23:44:21 +01:00
Peter Bourgon
179c7a5f7c Make -v, --version optional 2014-11-12 12:38:58 +01:00
Audrius Butkevicius
e38bac8225 Print author 2014-07-26 22:03:32 +01:00
Jeremy Saenz
8c34b12d83 Merge pull request #114 from AudriusButkevicius/shortcut
Add App.RunAndExitOnError shortcut
2014-07-15 12:30:47 -07:00
Audrius Butkevicius
449f261ee9 Add App.RunAndExitOnError shortcut 2014-07-13 18:56:43 +01:00
Audrius Butkevicius
4a645835f0 Add HideHelp flag in App and Command 2014-07-13 18:51:09 +01:00
Philippe Lafoucrière
df5fb46048 Fix global flags in Subcommands
closes #69
2014-07-06 11:04:48 +02: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
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
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
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
Greg B
f7c1cd9a11 Add before function to app 2014-01-06 15:06:31 -08:00
Katrina Owen
7d08fb3da5 Add shortcut for version flag 2013-12-02 14:55:24 -08: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
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
Jared Forsyth
ccb1528bb0 adding multi-named flags 2013-11-18 16:35:23 -07:00
Alexander Rødseth
7050f048d1 Added simple man page support 2013-11-15 12:40:18 +01: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
e6e641143c JMS #39: App.Run returns an error 2013-11-01 07:33:15 -07:00
Jeremy Saenz
0d3c3f4497 Improved documentation 2013-11-01 07:31:37 -07:00
Jeremy Saenz
e5c31ab592 JMS-34: App.Run() can now be run multiple times.
- Added a method for looking up commands
- Using some logic to make sure default flags are not added more than
  once
2013-09-14 16:10:38 -07: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
70eacca641 JMS #25: Added support for help flags 2013-07-24 07:35:45 -07:00
Jeremy Saenz
ed1ee94250 Adding some docs 2013-07-20 15:50:13 -07:00
Jeremy Saenz
d8cf49f0dd Printing out version numbers 2013-07-20 08:44:09 -07:00
Jeremy Saenz
04490dabec Minor tweaks and cleanup 2013-07-20 08:21:20 -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