Files
warewulf/internal/app/wwctl/node/imprt/root.go
Jonathon Anderson 08a8eb430c wwctl node args and completions
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-02-09 16:13:40 -07:00

36 lines
901 B
Go

package imprt
import (
"fmt"
"github.com/spf13/cobra"
)
var (
baseCmd = &cobra.Command{
DisableFlagsInUseLine: true,
Use: "import [OPTIONS] NODENAME",
Short: "Import node(s) from yaml file",
Long: "This command imports all the nodes defined in a file. It will overwrite nodes with same name.",
RunE: CobraRunE,
Args: cobra.ExactArgs(1),
Aliases: []string{"import"},
}
ImportCVS bool
)
func init() {
baseCmd.PersistentFlags().BoolVarP(&ImportCVS, "cvs", "c", false, "Import CVS file")
}
// GetRootCommand returns the root cobra.Command for the application.
func GetCommand() *cobra.Command {
return baseCmd
}
func Usage() {
fmt.Println(`The csv file must be structured in following way:
node,option1,option2,net.netname1.netopt
node01,value1,value2,net.netname1,netvalue`)
}