generate man pages via sub command

Signed-off-by: Christian Goll <cgoll@suse.de>
This commit is contained in:
Christian Goll
2023-03-02 11:01:11 +01:00
parent ab2139a1fd
commit 94866656a4
8 changed files with 52 additions and 78 deletions

View File

@@ -6,18 +6,18 @@ import (
"github.com/spf13/cobra"
)
func CobraRunE(cmd *cobra.Command, args []string) error {
func CobraRunE(cmd *cobra.Command, args []string) (err error) {
myArg := "bash"
if len(args) == 1 {
myArg = args[0]
}
switch myArg {
case "zsh":
cmd.GenZshCompletion(os.Stdout)
err = cmd.Parent().Parent().GenZshCompletion(os.Stdout)
case "fish":
cmd.GenFishCompletion(os.Stdout, true)
err = cmd.Parent().Parent().GenFishCompletion(os.Stdout, true)
default:
cmd.GenBashCompletion(os.Stdout)
err = cmd.Parent().Parent().GenBashCompletion(os.Stdout)
}
return nil
return
}