Skip to content

Commit 63b6ab9

Browse files
committed
Add support for fish completion
1 parent 5efb842 commit 63b6ab9

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

.goreleaser.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ brews:
9292
(bash_completion/"golangci-lint").write output
9393
output = Utils.popen_read("#{bin}/golangci-lint completion zsh")
9494
(zsh_completion/"_golangci-lint").write output
95+
output = Utils.popen_read("#{bin}/golangci-lint completion fish")
96+
(fish_completion/"eksctl.fish").write output
9597
prefix.install_metafiles
9698
test: |
9799
system "#{bin}/golangci-lint --version"

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ require (
4545
github.com/sirupsen/logrus v1.6.0
4646
github.com/sonatard/noctx v0.0.1
4747
github.com/sourcegraph/go-diff v0.6.0
48-
github.com/spf13/cobra v1.0.0
48+
github.com/spf13/cobra v1.0.1-0.20200710201246-675ae5f5a98c
4949
github.com/spf13/pflag v1.0.5
5050
github.com/spf13/viper v1.7.1
5151
github.com/ssgreg/nlreturn/v2 v2.1.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,8 @@ github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI=
344344
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
345345
github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8=
346346
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
347-
github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8=
348-
github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=
347+
github.com/spf13/cobra v1.0.1-0.20200710201246-675ae5f5a98c h1:/dP/1GnfVIlWnB0YDImenSmneUCw3wjyq2RMgAG1e2o=
348+
github.com/spf13/cobra v1.0.1-0.20200710201246-675ae5f5a98c/go.mod h1:aeNIJzz/GSSVlS+gpCpQWZ83BKbsoW57mr90+YthtkQ=
349349
github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk=
350350
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
351351
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=

pkg/commands/completion.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ func (e *Executor) initCompletion() {
2828
RunE: e.executeZshCompletion,
2929
}
3030
completionCmd.AddCommand(zshCmd)
31+
32+
fishCmd := &cobra.Command{
33+
Use: "fish",
34+
Short: "Output fish completion script",
35+
RunE: e.executeFishCompletion,
36+
}
37+
completionCmd.AddCommand(fishCmd)
3138
}
3239

3340
func (e *Executor) executeBashCompletion(cmd *cobra.Command, args []string) error {
@@ -51,3 +58,12 @@ func (e *Executor) executeZshCompletion(cmd *cobra.Command, args []string) error
5158

5259
return nil
5360
}
61+
62+
func (e *Executor) executeFishCompletion(cmd *cobra.Command, args []string) error {
63+
err := cmd.Root().GenFishCompletion(os.Stdout, true)
64+
if err != nil {
65+
return errors.Wrap(err, "unable to generate fish completions: %v")
66+
}
67+
68+
return nil
69+
}

0 commit comments

Comments
 (0)