Refactor to completions.Profiles

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2025-02-05 18:56:16 -07:00
parent 60872bd42e
commit b05e384560
4 changed files with 16 additions and 28 deletions

View File

@@ -36,18 +36,10 @@ func GetCommand() *cobra.Command {
Short: "Configure node profile properties",
Long: "This command sets configuration properties for the node PROFILE(s).\n\n" +
"Note: use the string 'UNSET' to remove a configuration",
Aliases: []string{"modify"},
Args: cobra.MinimumNArgs(0),
RunE: CobraRunE(&vars),
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
if len(args) != 0 {
return nil, cobra.ShellCompDirectiveNoFileComp
}
nodeDB, _ := node.New()
profiles := nodeDB.ListAllProfiles()
return profiles, cobra.ShellCompDirectiveNoFileComp
},
Aliases: []string{"modify"},
Args: cobra.MinimumNArgs(0),
RunE: CobraRunE(&vars),
ValidArgsFunction: completions.Profiles,
}
vars.profileConf.CreateFlags(baseCmd)
vars.profileDel.CreateDelFlags(baseCmd)