Commit Graph

59 Commits

Author SHA1 Message Date
spf13 71bb1dfdcd Cobra behavior is now more consistent. Invalid flags cause Usage to be printed. 2014-06-13 20:00:56 -04:00
Alan Pearce 7ab4fd75e9 Fix grammar in readme 2014-05-27 14:54:43 -04:00
Ryan Cox 0330aef05c Fix small typo 2014-05-09 23:30:45 -04:00
spf13 59bd285b5f Documentation update 2014-04-11 10:11:09 -04:00
tummychow 667c348dbd Test behavior for subcommand with same name as root command
If, for some reason, you have an application with some name "foo", and your
app has a subcommand "foo", cobra should behave properly when you call
"foo foo", and it should also behave if you call "foo f".

These changes verify both of these cases and ensure cobra responds properly.
2014-03-26 16:19:34 -04:00
tummychow 4c29b190e0 Add basic test for prefix matching 2014-03-26 05:12:48 -04:00
tummychow 96d543cf2c Reset root command lists in testing
This fixes some issues that appear when testing prefix invocations. Since the
root command lists weren't being cleared, the list would persist between
tests, so there would be multiple instances of each command. Then, if you
tried to match a prefix of one of those commands, you'd get two matches (one
for each instance) and the command would fail.

Resetting the root command lists prevents them from persisting between tests,
resolving this issue.
2014-03-26 05:12:48 -04:00
tummychow f4c075f8f8 Add command name prefix matching
A command can now be invoked with a prefix of its own name, assuming that
prefix is unambiguous (ie it isn't also a prefix of any sibling command's
name).
2014-03-26 05:12:44 -04:00
Kevin Darlington e174a40cf5 Print root usage when help called with no args. 2014-02-03 21:52:51 -05:00
Steve Francia 1e1ff9e35e Merge pull request #8 from awilliams/master
Right aligns "Use" and "Additional help topics"
2014-01-17 05:19:31 -08:00
awilliams 2e73a96a48 Right aligns "Use" and "Additional help topics" even if they are longer than the min padding 2014-01-17 13:36:57 +01:00
Steve Francia 6dd0aa154a Merge pull request #7 from philips/patch-1
fix(README): simple grammar fixup
2014-01-11 22:21:44 -08:00
Brandon Philips 2d10990d9e fix(README): simple grammar fixup 2014-01-11 21:34:06 -08:00
Steve Francia 88d4f7089f Merge pull request #5 from mcuadros/master
Fixes in example
2014-01-02 09:56:32 -08:00
Steve Francia 56185423c7 Merge pull request #6 from bitdeli-chef/master
Add a Bitdeli Badge to README
2014-01-02 09:56:03 -08:00
Bitdeli Chef d7f66b2f69 Add a Bitdeli badge to README 2014-01-02 17:58:43 +00:00
Máximo Cuadros 1378a36255 Fixes in example 2013-12-21 11:32:14 +01:00
spf13 fae133554d Fixing error messaging when upstream flag library is inconsistent. 2013-11-05 20:04:51 -05:00
spf13 2f19d3c266 Added test for (fixed) bug in upstream library pflag 2013-11-05 19:50:47 -05:00
spf13 7216b06e83 Rewrote readme 2013-11-05 12:50:11 -05:00
spf13 79bdde5f6c Refactored code to eliminate need for a commander. Much simpler interface now. 2013-11-01 18:36:24 -04:00
spf13 a2845e7f7a fixed spf13/cobra#1 spf13/hugo#88 2013-09-30 21:54:46 -04:00
spf13 fb5077acbe Better handling of parsing args to commands, especially the root 2013-09-29 02:03:29 -04:00
spf13 2d02c310f3 Help improvements 2013-09-29 02:02:49 -04:00
spf13 6b3d2f2e9a Shorter message when invalid flags provided 2013-09-29 02:01:56 -04:00
spf13 55ff474dee Finding command based on args cleaned up 2013-09-29 01:59:13 -04:00
spf13 74ce44d76e Add ability to cast a command to a commander 2013-09-29 01:57:50 -04:00
spf13 88e482c582 Update read me example 2013-09-29 01:56:04 -04:00
spf13 39583856c0 fix trailing <nil> on help output 2013-09-28 22:42:30 -04:00
spf13 c491be3a31 Adding Travis status image to readme 2013-09-24 17:08:47 -04:00
spf13 0556e5fbf9 Moving cobra_test into package cobra for easier testing 2013-09-24 17:04:00 -04:00
spf13 b6689aaea4 more in the readme 2013-09-24 16:52:33 -04:00
spf13 f0d16a4984 more complete readme 2013-09-24 16:45:20 -04:00
spf13 fb2146e9e5 Add support for help command 2013-09-24 16:03:22 -04:00
spf13 68f3c66d07 Proper handling of flag error messages. Fixing test that wasn't passing. 2013-09-24 13:15:30 -04:00
spf13 62fb674a93 Organize the files a bit better 2013-09-24 12:47:29 -04:00
spf13 88b9d2e5cb Adding support for travis ci 2013-09-24 12:39:05 -04:00
spf13 57fc2cb534 Support and test for custom output. 2013-09-24 12:12:32 -04:00
spf13 b0c5461629 Much improved usage message 2013-09-13 00:09:28 -04:00
spf13 8858462331 Add decent usage message 2013-09-12 10:37:35 -04:00
spf13 6067837866 Adding support for a custom output, default to stderr 2013-09-11 09:52:15 -04:00
spf13 8d87882095 Documentation & housecleaning 2013-09-11 09:52:15 -04:00
spf13 7ba2df2eff Detect and panic if command is setup as it's own child. 2013-09-10 18:28:58 -04:00
spf13 90b975fd8e Rewrote DebugFlags() function 2013-09-10 18:27:31 -04:00
spf13 c5eb49e3f5 Add better persistent flags testing 2013-09-10 18:26:46 -04:00
spf13 061ba30a84 Create and utilize mergePersistentFlags method 2013-09-10 18:26:17 -04:00
Steve Francia ed6206272d Deleting Extra license file... keeping the better formatted one 2013-09-04 11:48:46 -04:00
spf13 3f47f33e39 Testing when given missing flag 2013-09-04 11:32:51 -04:00
spf13 ccbe1b2359 Adding debug flags method to a command & commander 2013-09-04 11:32:51 -04:00
spf13 c568b575aa Better testing support. Easy to reset to blank slate in tests. 2013-09-04 11:32:51 -04:00