Files
warewulf/internal/app/wwctl/overlay/build/root.go
Christian Goll a97c204f53 Use wwctl overlay <import|build> --workers=0 to indicate default value
By default, uses `runtime.NumCPU()`

The default value is rendered in the generated man pages, which made
their content dependent on build system characteristics.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-03-01 11:46:15 +01:00

37 lines
1.2 KiB
Go

package build
import (
"github.com/spf13/cobra"
"github.com/warewulf/warewulf/internal/app/wwctl/completions"
)
var (
baseCmd = &cobra.Command{
DisableFlagsInUseLine: true,
Use: "build [OPTIONS] NODENAME...",
Short: "(Re)build node overlays",
Long: "This command builds overlays for given nodes.",
RunE: CobraRunE,
ValidArgsFunction: completions.Nodes,
}
OverlayNames []string
OverlayDir string
Workers int
)
func init() {
baseCmd.PersistentFlags().StringSliceVarP(&OverlayNames, "overlay", "O", []string{}, "Build only specific overlay(s)")
if err := baseCmd.RegisterFlagCompletionFunc("overlay", completions.Overlays); err != nil {
panic(err)
}
baseCmd.PersistentFlags().StringVarP(&OverlayDir, "output", "o", "", `Do not create an overlay image for distribution but write to
the given directory. An overlay must also be ge given to use this option.`)
baseCmd.PersistentFlags().IntVar(&Workers, "workers", 0, "The number of parallel workers building overlays (<=0 indicates 1 worker per CPU)")
}
// GetRootCommand returns the root cobra.Command for the application.
func GetCommand() *cobra.Command {
return baseCmd
}