Files
warewulf/internal/app/wwctl/power/soft/root.go
Tobias Ribizel 301082cdd7 add docstring for node patterns
Signed-off-by: Tobias Ribizel <mail@ribizel.de>
2025-07-06 16:36:45 +02:00

30 lines
1.0 KiB
Go

package soft
import (
"github.com/spf13/cobra"
"github.com/warewulf/warewulf/internal/app/wwctl/completions"
"github.com/warewulf/warewulf/internal/pkg/hostlist"
)
type variables struct {
Showcmd bool
Fanout int
}
// GetRootCommand returns the root cobra.Command for the application.
func GetCommand() *cobra.Command {
vars := variables{}
powerCmd := &cobra.Command{
DisableFlagsInUseLine: true,
Use: "soft [OPTIONS] [PATTERN ...]",
Short: "Gracefully shuts down the given node(s)",
Long: "This command uses the operating system to shut down the set of nodes specified by PATTERN.\n" + hostlist.Docstring,
RunE: CobraRunE(&vars),
Args: cobra.MinimumNArgs(1),
ValidArgsFunction: completions.Nodes,
}
powerCmd.PersistentFlags().BoolVarP(&vars.Showcmd, "show", "s", false, "only show command which will be executed")
powerCmd.PersistentFlags().IntVar(&vars.Fanout, "fanout", 50, "how many command should be executed in parallel")
return powerCmd
}