spf13
a7defd47ef
add add command functionality to cobra
2015-10-28 13:43:58 -04:00
spf13
ea5bc31ac4
Add cobra generator application
2015-10-28 12:51:48 -04:00
Eric Paris
230787ee13
Merge pull request #169 from apriendeau/silence-errors
...
[silence-errors]: adds a way for errors to silenced down the stack
2015-10-26 19:12:39 -05:00
Austin Riendeau
2244c3923a
[silence-errors]: adds comments around code
2015-10-26 17:42:06 -06:00
Austin Riendeau
4729b374ae
[silence-errors]: adds Silence Usage
2015-10-26 17:38:08 -06:00
Austin Riendeau
03aabcda72
adds inheritance for SilenceErrors
2015-10-25 21:17:39 -06:00
Austin Riendeau
f6e1a2df92
[silence-errors]: -m adds a way for errors to silenced down the stack
2015-10-25 19:58:53 -06:00
Eric Paris
8b2293c741
Merge pull request #167 from siddharthist/docs/ArgsLenAtDash
...
Added documentation for ArgsLenAtDash
2015-10-13 17:51:39 -05:00
siddharthist
c4d6dbe059
Added documentation for ArgsLenAtDash
2015-10-13 15:41:57 -07:00
Eric Paris
d732ab3a34
Merge pull request #164 from vikstrous/fix_bug
...
fix bug with PersistentPreRunE
2015-09-30 09:31:26 -04:00
Viktor Stanchev
72ee37f33e
fix bug with PersistentPreRunE
2015-09-30 00:09:17 -07:00
Eric Paris
046a673252
Merge pull request #163 from fabianofranz/siblings_improvements
...
Improve suggestions
2015-09-29 11:27:22 -04:00
Fabiano Franz
a83a172122
Improve suggestions - add explicit SuggestFor attribute
2015-09-25 12:07:38 -03:00
Fabiano Franz
3afa4db2c6
Improve suggestions - prefix will match
2015-09-25 11:41:47 -03:00
Eric Paris
53d96508f5
Merge pull request #160 from eparis/len-at-dash
...
Provide the length of Args when a -- is found in commandline
2015-09-17 16:09:08 -05:00
Eric Paris
edde52e321
Provide the length of Args when a -- is found in commandline
...
This allows a program to know what args came before the -- and what args
came after.
2015-09-16 12:31:41 -04:00
Eric Paris
4b76e97cd6
Merge pull request #158 from eparis/more-errors-in-test
...
More error output if a could of _test fail
2015-09-15 22:57:41 -05:00
Eric Paris
664a3ab4a3
Merge pull request #159 from eparis/travis
...
Update travis to use more versions of go
2015-09-15 22:57:29 -05:00
Eric Paris
6e4e76655d
More error output if a could of _test fail
2015-09-15 18:02:03 -04:00
Eric Paris
79996f7fcf
Update travis to use more versions of go
2015-09-15 18:01:43 -04:00
Eric Paris
6d70311770
Merge pull request #149 from fabianofranz/siblings
...
Allows command suggestions along with "unknown command" errors
2015-09-13 22:44:46 -05:00
Fabiano Franz
b4087da7eb
Allows command suggestions along with "unknown command" errors
2015-09-13 23:35:10 -03:00
Eric Paris
b28774dd68
Merge pull request #154 from eparis/fix-trailing-newline
...
If nothing after flags: sting print a newline
2015-09-11 23:27:51 -05:00
Eric Paris
632e090805
If nothing after flags: sting print a newline
2015-09-12 00:21:31 -04:00
Eric Paris
eeec8e3ce3
Merge pull request #153 from eparis/remove-useless-assignment
...
UsageTemple: remove useless variable assignment
2015-09-11 18:00:59 -05:00
Eric Paris
d96b4f7741
Merge pull request #152 from eparis/no-newline-after-flags
...
No newline after Flags in usage
2015-09-11 18:00:50 -05:00
Eric Paris
1ac08d9d94
UsageTemple: remove useless variable assignment
2015-09-11 18:52:47 -04:00
Eric Paris
85bb343e9c
Merge pull request #151 from eparis/no-newline-without-short
...
No leading newline if Short and Long both unset
2015-09-11 17:46:37 -05:00
Eric Paris
0d9b07baf9
Merge pull request #150 from eparis/help-not-available
...
Do not count "help" as "Available"
2015-09-11 17:46:27 -05:00
Eric Paris
8af2b2b89f
No newline after Flags in usage
...
The flags usage template from pflags has a trailing \n. We need to
include a newline in case there are no flags in our template. This will
trim the newline from the end of the flags from pflag and we can do it
right outselves.
2015-09-11 18:45:28 -04:00
Eric Paris
717619095e
No leading newline if Short and Long both unset
...
Before --help would start
```
Usage:
command [flags]
[...]
```
After --help will show
```
Usage:
command [flags]
[...]
```
2015-09-11 18:28:40 -04:00
Eric Paris
24b4b01ffa
Do not cound "help" as "Available"
2015-09-11 18:25:28 -04:00
Eric Paris
42498ec777
Merge pull request #148 from tamird/trailing-spaces
...
trim trailing whitespace
2015-09-11 17:24:06 -05:00
Tamir Duberstein
5f83d08ae0
trim trailing whitespace
2015-09-11 13:25:15 -04:00
Eric Paris
4b86c66ef2
Merge pull request #146 from eparis/is-available-rework
...
Update IsAvailableCommand checks
2015-09-09 14:20:07 -05:00
Eric Paris
3eac1434ef
Update IsAvailableCommand checks
...
This slightly changes IsAvailableCommand in that a non-runnable command
with a runnable subcommand is now 'Available'
We also use IsAvailableCommand in the rest of the codebase instead of
half kinda sorta doing it incorrectly other places.
2015-09-08 22:48:12 -04:00
Eric Paris
75d96d75c3
Merge pull request #145 from eparis/man-cleanups
...
Enhance Man Page Generation
2015-09-08 18:19:27 -05:00
Eric Paris
b625a4db24
Merge pull request #143 from sdomino/feature/hidden-commands
...
Feature/hidden commands
2015-09-08 18:19:22 -05:00
Steve Domino
6d2f1d2fa7
Ability to hide commands from usage/help text
...
Added the ability to have hidden commands that cobra will still run as intended, however they won't show up in any usage/help text
adding internal field to command
private is a better name
hiding private commands in default help/usage
opting for 'hidden' over 'private'
updating all 'help command' checks to exclude hidden commands
updating how commands are displayed in usage/help text by updating/adding some methods. added tests for hidden/deprecated commands
making command hidden when testing hidden command execution
test now leverage the included suite and are much less custom. also removed deprecation tests, once I discovered them in cobra_test.go
updating hidden command test to be more reliable
removing unnecessary () when checking len(c.Deprecated)
updating command comments to be godoc friendly
2015-09-08 17:01:13 -06:00
Eric Paris
edcf765d9f
Mangen: allow callers to specify header information
...
We previously had this weak argument called projectName which let you
set a single part of a man page header. Instead do the best we can if
the caller doesn't pass us anything, but let the caller specify anything
they want.
2015-09-08 18:52:09 -04:00
Eric Paris
cfecf1379c
manpage generation: Make sure parent in SEE ALSO has dashes
...
The CommandPath() for a parent might have a space (if .Parent() != .Root())
so we need to replace those spaces with `-`
2015-09-08 12:32:15 -04:00
Eric Paris
68f5a81a72
Merge pull request #141 from eparis/mac-completions
...
Enable bash completions on Macs
2015-09-04 09:11:03 -05:00
Eric Paris
32e87e3c8e
Enable bash completions on Macs
...
If they installed bash-completions from homebrew, this should make our
completions work.
2015-09-03 17:00:18 -04:00
Eric Paris
16b4170663
Merge pull request #138 from eparis/cleanup-helpfunc
...
Allow SetHelpFunc to overwrite the --help flag instead of just the help subcommand
2015-09-03 15:53:20 -05:00
Bjørn Erik Pedersen
1ba88c48dd
Merge pull request #139 from alexanderguy/RunE-is-runnable
...
RunE commands should be considered runnable.
2015-09-02 20:19:19 +02:00
Alexander Guy
823f6890b7
RunE commands should be considered runnable.
2015-09-02 10:59:31 -07:00
Eric Paris
c2d19e9c43
Use the HelpFunc for the --help flag
...
We were just calling Help() when a user set the --help flag. You could
overwrite how the help subcommand worked with SetHelpFunc, but not now
the --help flag worked.
2015-09-01 14:25:38 -04:00
Eric Paris
27bf24802c
Redo HelpFunc() to work things other than the help subcommand
...
Today the HelpFunc() seemed to be tailor built for the `help`
subcommand. Which has a rather weird purpose as its `Run` needs to
find the actual command we want to get help about.
Instead make the HelpFunc() for a command be about that command,
rather than having it search for some other command...
2015-09-01 14:25:32 -04:00
Eric Paris
1f92281ffc
Merge pull request #135 from akutz/feature/custom-templ-funcs
...
Template Function Injection
2015-09-01 11:55:58 -05:00
Eric Paris
e15d674de6
Merge pull request #134 from apriendeau/master
...
#67 creates RunE functions to allow for errors to populate to the top
2015-09-01 11:51:29 -05:00