Skip to content

Commit 5cea9b6

Browse files
authored
Merge pull request #2154 from nberlee/fish-completion
feat: add fish completion
2 parents 8da76ac + 5b16b6c commit 5cea9b6

3 files changed

Lines changed: 22 additions & 4 deletions

File tree

cmd/completion.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ const (
1818
$ brew install bash-completion
1919
$ source $(brew --prefix)/etc/bash_completion
2020
$ devspace completion bash > ~/.devspace-completion # for bash users
21+
$ devspace completion fish > ~/.devspace-completion # for fish users
2122
$ devspace completion zsh > ~/.devspace-completion # for zsh users
2223
$ source ~/.devspace-completion
2324
Ubuntu:
2425
$ apt-get install bash-completion
2526
$ source /etc/bash-completion
2627
$ source <(devspace completion bash) # for bash users
28+
$ devspace completion fish | source # for fish users
2729
$ source <(devspace completion zsh) # for zsh users
2830
2931
Additionally, you may want to output the completion to a file and source in your .bashrc
@@ -42,7 +44,7 @@ func NewCompletionCmd() *cobra.Command {
4244
}
4345
return cobra.OnlyValidArgs(cmd, args)
4446
},
45-
ValidArgs: []string{"bash", "zsh"},
47+
ValidArgs: []string{"bash", "fish", "zsh"},
4648
Short: "Outputs shell completion for the given shell (bash or zsh)",
4749
Long: longDescription,
4850
RunE: completion,
@@ -53,6 +55,8 @@ func completion(cmd *cobra.Command, args []string) error {
5355
switch args[0] {
5456
case "bash":
5557
return rootCmd(cmd).GenBashCompletion(os.Stdout)
58+
case "fish":
59+
return rootCmd(cmd).GenFishCompletion(os.Stdout, true)
5660
case "zsh":
5761
err := rootCmd(cmd).GenZshCompletion(os.Stdout)
5862
if err != nil {

docs/pages/cli.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@ title: "devspace --help"
33
sidebar_label: devspace
44
---
55

6+
## devspace
7+
8+
Welcome to the DevSpace!
9+
610
### Synopsis
7-
```
11+
812
DevSpace accelerates developing, deploying and debugging applications with Docker and Kubernetes. Get started by running the init command in one of your projects:
913

1014
devspace init
11-
```
1215

13-
### Global Flags
16+
### Options
17+
1418
```
1519
--debug Prints the stack trace if an error occurs
1620
--disable-profile-activation If true will ignore all profile activations
@@ -25,3 +29,11 @@ DevSpace accelerates developing, deploying and debugging applications with Docke
2529
-s, --switch-context Switches and uses the last kube context and namespace that was used to deploy the DevSpace project
2630
--var strings Variables to override during execution (e.g. --var=MYVAR=MYVALUE)
2731
```
32+
33+
```
34+
35+
```
36+
37+
38+
## Flags
39+
## Global & Inherited Flags

docs/pages/cli/devspace_completion.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ Outputs shell completion for the given shell (bash or zsh)
2121
$ brew install bash-completion
2222
$ source $(brew --prefix)/etc/bash_completion
2323
$ devspace completion bash > ~/.devspace-completion # for bash users
24+
$ devspace completion fish > ~/.devspace-completion # for fish users
2425
$ devspace completion zsh > ~/.devspace-completion # for zsh users
2526
$ source ~/.devspace-completion
2627
Ubuntu:
2728
$ apt-get install bash-completion
2829
$ source /etc/bash-completion
2930
$ source <(devspace completion bash) # for bash users
31+
$ devspace completion fish | source # for fish users
3032
$ source <(devspace completion zsh) # for zsh users
3133

3234
Additionally, you may want to output the completion to a file and source in your .bashrc

0 commit comments

Comments
 (0)