wwctl image completions and arguments
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
@@ -11,10 +11,6 @@ import (
|
||||
)
|
||||
|
||||
func CobraRunE(cmd *cobra.Command, args []string) (err error) {
|
||||
if len(args) != 2 {
|
||||
return fmt.Errorf("rename requires 2 arguments: %d provided", len(args))
|
||||
}
|
||||
|
||||
crp := &wwapiv1.ImageRenameParameter{
|
||||
ImageName: args[0],
|
||||
TargetName: args[1],
|
||||
|
||||
@@ -2,7 +2,7 @@ package rename
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/warewulf/warewulf/internal/pkg/image"
|
||||
"github.com/warewulf/warewulf/internal/app/wwctl/completions"
|
||||
)
|
||||
|
||||
var baseCmd = &cobra.Command{
|
||||
@@ -12,14 +12,8 @@ var baseCmd = &cobra.Command{
|
||||
Short: "Rename an existing image",
|
||||
Long: "This command will rename an existing image.",
|
||||
RunE: CobraRunE,
|
||||
Args: cobra.MinimumNArgs(2),
|
||||
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
if len(args) != 0 {
|
||||
return nil, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
list, _ := image.ListSources()
|
||||
return list, cobra.ShellCompDirectiveNoFileComp
|
||||
},
|
||||
Args: cobra.ExactArgs(2),
|
||||
ValidArgsFunction: completions.Images(1),
|
||||
}
|
||||
|
||||
var SetBuild bool
|
||||
|
||||
Reference in New Issue
Block a user