added wwctl genconf used to generate completions

Signed-off-by: Christian Goll <cgoll@suse.de>
This commit is contained in:
Christian Goll
2023-03-01 16:42:58 +01:00
parent 2c9a241643
commit ab2139a1fd
5 changed files with 86 additions and 17 deletions

View File

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