Commit Graph

18 Commits

Author SHA1 Message Date
Adam Bozanich fe79245d1a Bash completion for names with ':' character. 2015-12-09 20:57:45 -08:00
Anthony Fok 0e4c02d9cb Restore bash completion behaviour for bash 4.x
In Pull Request #178, the use of `builtin compopt` as a test condition
is inappropriate.  Use `[[ $(type -t compopt) = "builtin" ]]` instead.

Also clean up formatting of the resulting bash completion script.
2015-11-07 04:39:28 -07:00
Fabiano Franz 7290a944e4 Allow marking persistent flags as required or filename 2015-11-06 08:43:09 -05:00
Fabiano Franz dab963a797 Persistent flags should also be used in completions 2015-11-06 08:43:09 -05:00
Eric Paris 2e6a428921 Merge pull request #179 from eparis/init_comp
Check for _init_completion not_init_completionS
2015-11-03 15:41:40 -05:00
Matt McCoy 428babeb31 Modifying bash completions so they can run on OSX 2015-11-03 15:21:24 -05:00
Eric Paris 58e38f95da Check for _init_completion not_init_completionS 2015-11-03 15:09:37 -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 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 9e7788657f Auto generation of a man page 2015-08-21 01:10:13 -07:00
Anthony Fok 1e6fdf608f Add new BashCompSubdirsInDir annotation
This first `cd` to a specified directory, then
lists the subdirectories therein with `_filedir -d`.

This can be used by e.g. `hugo --theme=[Tab][Tab]`, which would
give a list of subdirectories under the `themes` directory.
2015-08-09 13:30:58 -06:00
Jordan Liggitt 6119fc993e Simplify setting file/extension annotations on a flag 2015-06-22 15:16:00 -04:00
Eric Paris dff410ab56 make filename extension handling a bash function
We were trying to call a bash function with bash stuff like @ () from a
variable.  Stop that.  Just call a function with an arg from a variable
instead of trying to pass around the bash.

Should fix https://github.com/spf13/cobra/pull/103
2015-05-04 18:41:53 -04:00
Eric Paris f4b3401f9e Clean up minor bash complaints from shellcheck.net 2015-05-04 14:40:27 -04:00
Eric Paris c3e48f996d Deprecated subcommands
They should still work, but shouldn't show up in help or usage output
2015-04-29 13:08:20 -04:00
Eric Paris 0fc734c3c5 Sort the valid args before output
We do this so we get stable repeatable output and can see if updates are
necessary or if it is just golang doing the same thing twice differently
2015-04-13 18:44:05 -04:00
Eric Paris a068307565 add a helper to annotate a flag as 'required' by a command 2015-04-07 20:14:18 -04:00
Eric Paris 9b2e6822e5 Add bash autocompletion generator
Given a (potentially annotated) cobra command you can generate a bash
completion script.
2015-04-07 20:13:49 -04:00