File tree Expand file tree Collapse file tree 8 files changed +90
-4
lines changed Expand file tree Collapse file tree 8 files changed +90
-4
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,14 @@ Docs for each command can be found at [`/docs`](docs/param.md)
29
29
30
30
They are automatically generated by Cobra.
31
31
32
+ ## Command Completion
33
+
34
+ To enable shell completion, you can run:
35
+
36
+ param completion (bash|zsh)
37
+
38
+ To enable either ` bash ` or ` zshell ` completion
39
+
32
40
## TODO
33
41
34
42
- Set command - Command to set parameters
Original file line number Diff line number Diff line change
1
+ // +build ignore
2
+
1
3
package main
2
4
3
5
import (
Original file line number Diff line number Diff line change
1
+ package cmd
2
+
3
+ import (
4
+ "os"
5
+
6
+ "github.com/spf13/cobra"
7
+ )
8
+
9
+ var completionCmd = & cobra.Command {
10
+ Use : "completion (bash|zsh)" ,
11
+ Short : "Generates shell completion scripts" ,
12
+ Long : `Output shell completion code for the specified shell (bash or zsh).
13
+ The shell code must be evaluated to provide interactive completion of param commands.
14
+ This can be done by sourcing it from ~/.bashrc
15
+
16
+ Examples:
17
+ # Installing bash completion
18
+ printf "
19
+ # param shell completion
20
+ source <(param completion bash)
21
+ " >> $HOME/.bashrc
22
+ source $HOME/.bashrc` ,
23
+ Args : cobra .OnlyValidArgs ,
24
+ ValidArgs : []string {"bash" , "zsh" },
25
+ Run : func (cmd * cobra.Command , args []string ) {
26
+ if args [0 ] == "bash" {
27
+ RootCmd .GenBashCompletion (os .Stdout )
28
+ } else if args [0 ] == "zsh" {
29
+ RootCmd .GenZshCompletion (os .Stdout )
30
+ }
31
+ },
32
+ }
33
+
34
+ func init () {
35
+ RootCmd .AddCommand (completionCmd )
36
+ }
Original file line number Diff line number Diff line change @@ -16,7 +16,8 @@ Param is a cli tool to improve interacting with AWS Parameter Store.
16
16
### SEE ALSO
17
17
18
18
* [ param add] ( param_add.md ) - Add a paramter to Parameter Store.
19
+ * [ param completion] ( param_completion.md ) - Generates shell completion scripts
19
20
* [ param copy] ( param_copy.md ) - Copy a parameter to clipboard.
20
21
* [ param list] ( param_list.md ) - List parameters in Parameter Store.
21
22
22
- ###### Auto generated by spf13/cobra on 1 -Jul-2018
23
+ ###### Auto generated by spf13/cobra on 2 -Jul-2018
Original file line number Diff line number Diff line change @@ -27,4 +27,4 @@ param add [flags]
27
27
28
28
* [ param] ( param.md ) - Tools to improve Parameter Store on the command line.
29
29
30
- ###### Auto generated by spf13/cobra on 1 -Jul-2018
30
+ ###### Auto generated by spf13/cobra on 2 -Jul-2018
Original file line number Diff line number Diff line change
1
+ ## param completion
2
+
3
+ Generates shell completion scripts
4
+
5
+ ### Synopsis
6
+
7
+ Output shell completion code for the specified shell (bash or zsh).
8
+ The shell code must be evaluated to provide interactive completion of param commands.
9
+ This can be done by sourcing it from ~ /.bashrc
10
+
11
+ Examples:
12
+ # Installing bash completion
13
+ printf "
14
+ # param shell completion
15
+ source <(param completion bash)
16
+ " >> $HOME/.bashrc
17
+ source $HOME/.bashrc
18
+
19
+ ```
20
+ param completion (bash|zsh) [flags]
21
+ ```
22
+
23
+ ### Options
24
+
25
+ ```
26
+ -h, --help help for completion
27
+ ```
28
+
29
+ ### Options inherited from parent commands
30
+
31
+ ```
32
+ --config string config file (default is $HOME/.param.yaml)
33
+ ```
34
+
35
+ ### SEE ALSO
36
+
37
+ * [ param] ( param.md ) - Tools to improve Parameter Store on the command line.
38
+
39
+ ###### Auto generated by spf13/cobra on 2-Jul-2018
Original file line number Diff line number Diff line change @@ -27,4 +27,4 @@ param copy parameter_name [flags]
27
27
28
28
* [ param] ( param.md ) - Tools to improve Parameter Store on the command line.
29
29
30
- ###### Auto generated by spf13/cobra on 1 -Jul-2018
30
+ ###### Auto generated by spf13/cobra on 2 -Jul-2018
Original file line number Diff line number Diff line change @@ -28,4 +28,4 @@ param list [flags]
28
28
29
29
* [ param] ( param.md ) - Tools to improve Parameter Store on the command line.
30
30
31
- ###### Auto generated by spf13/cobra on 1 -Jul-2018
31
+ ###### Auto generated by spf13/cobra on 2 -Jul-2018
You can’t perform that action at this time.
0 commit comments