dynamic nouns for 'wwwctl kernel'

This commit is contained in:
Christian Goll
2021-09-24 14:36:54 +02:00
parent 8010cd2435
commit b3743657b2
3 changed files with 33 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
package imprt
import (
"github.com/hpcng/warewulf/internal/pkg/container"
"github.com/spf13/cobra"
)
@@ -26,6 +27,10 @@ func init() {
baseCmd.PersistentFlags().BoolVar(&SetDefault, "setdefault", false, "Set this kernel for the default profile")
baseCmd.PersistentFlags().StringVarP(&OptRoot, "root", "r", "/", "Import kernel from root (chroot) directory")
baseCmd.PersistentFlags().StringVarP(&OptContainer, "container", "C", "", "Import kernel from container")
baseCmd.RegisterFlagCompletionFunc("container", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
list, _ := container.ListSources()
return list, cobra.ShellCompDirectiveNoFileComp
})
}
// GetRootCommand returns the root cobra.Command for the application.