added wwctl genconf used to generate completions
Signed-off-by: Christian Goll <cgoll@suse.de>
This commit is contained in:
23
internal/app/wwctl/genconf/completions/main.go
Normal file
23
internal/app/wwctl/genconf/completions/main.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user