fix: linter - errcheck, added error handling
package cli
import (
+ "errors"
"os"
"github.com/spf13/cobra"
@@ -57,16 +58,17 @@ PS> epinio completion powershell > epinio.ps1
DisableFlagsInUseLine: true,
ValidArgs: []string{"bash", "zsh", "fish", "powershell"},
Args: cobra.ExactValidArgs(1),
- Run: func(cmd *cobra.Command, args []string) {
+ RunE: func(cmd *cobra.Command, args []string) error {
switch args[0] {
case "bash":
- cmd.Root().GenBashCompletion(os.Stdout)
+ return cmd.Root().GenBashCompletion(os.Stdout)
case "zsh":
- cmd.Root().GenZshCompletion(os.Stdout)
+ return cmd.Root().GenZshCompletion(os.Stdout)
case "fish":
- cmd.Root().GenFishCompletion(os.Stdout, true)
+ return cmd.Root().GenFishCompletion(os.Stdout, true)
case "powershell":
- cmd.Root().GenPowerShellCompletion(os.Stdout)
+ return cmd.Root().GenPowerShellCompletion(os.Stdout)
}
+ return errors.New("Internal error: Invalid shell")
},
}
