Commit graph

19 commits

Author SHA1 Message Date
Eric Paris
d89c499964 Allow commands to explicitly state if they do, or do not take arbitrary arguments
Check that arguments are in ValidArgs

If a command defined cmd.ValidArgs check that the argument is actually
in ValidArgs and fail if it is not.
2017-07-23 09:57:27 +02:00
Albert Nigmatzianov
84f471618b Make BenchmarkBashCompletion more honest
name              old time/op    new time/op    delta
BashCompletion-4    67.4µs ± 1%    50.8µs ± 3%  -24.63%  (p=0.000 n=17+19)

name              old alloc/op   new alloc/op   delta
BashCompletion-4    29.5kB ± 0%    29.5kB ± 0%   +0.00%  (p=0.020 n=20+20)

name              old allocs/op  new allocs/op  delta
BashCompletion-4       253 ± 0%       253 ± 0%     ~     (all equal)
2017-06-05 19:32:33 +02:00
Albert Nigmatzianov
fb1f39915d Add benchmark for GenBashCompletion 2017-05-18 15:03:00 +02:00
Albert Nigmatzianov
de6b168d98 Simplify bash_completions.go
Improve test coverage from 80% to 85%.
2017-05-18 15:03:00 +02:00
Chris Broadfoot
d1371ecdb4 gofmt, govet, run those in Travis, add 1.7 2016-08-23 13:30:43 -07:00
Euan Kemp
40e19b3f3b Don't display deprecated flags in bash completions 2016-08-02 15:01:33 -07:00
Euan Kemp
75daccd5b8 Don't display hidden flags in bash completions 2016-08-02 14:49:33 -07:00
Dr. Stefan Schimanski
defeccc04d Run shellcheck on bash completion 2016-04-02 23:16:12 +02:00
Eric Paris
60267ae24d Merge pull request #257 from sttts/sttts-noun-aliases
Add noun aliases
2016-04-02 09:29:34 -05:00
Dr. Stefan Schimanski
1a0a490d76 Remove plural handling and add aliases for nouns in completion 2016-04-02 12:39:19 +02:00
Ian Walter
a0bd6c17b3 Fixing golint warnings
* Moving final return outside of if-else
* Removing type declarations that Go can infer from values
* Cleaning up some existing comments
* Changing snake_case variables to camelCase
2016-03-31 09:53:34 -04:00
Dr. Stefan Schimanski
8092588fb8 Add custom bash flag completion 2016-03-21 08:05:54 +01:00
Adam Bozanich
fe79245d1a Bash completion for names with ':' character. 2015-12-09 20:57:45 -08:00
Fabiano Franz
7290a944e4 Allow marking persistent flags as required or filename 2015-11-06 08:43:09 -05: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
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
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