Core of image's duplication feature

This commit is contained in:
Arnaud Lecomte
2023-08-25 13:54:39 +02:00
parent 84e97d2169
commit b56f024e6f
8 changed files with 149 additions and 5 deletions

View File

@@ -0,0 +1,33 @@
package copy
import (
"github.com/hpcng/warewulf/internal/pkg/container"
"github.com/spf13/cobra"
)
var (
baseCmd = &cobra.Command{
DisableFlagsInUseLine: true,
Use: "cp CONTAINER NEW_NAME",
Short: "Copy an existing container",
Long: "This command will duplicate an imported container 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, _ := container.ListSources()
return list, cobra.ShellCompDirectiveNoFileComp
},
}
)
func init() {
// Nothing to do here
}
// GetRootCommand returns the root cobra.Command for the application.
func GetCommand() *cobra.Command {
return baseCmd
}