diff --git a/internal/app/wwctl/clean/root.go b/internal/app/wwctl/clean/root.go index a5af54b8..8f441d6b 100644 --- a/internal/app/wwctl/clean/root.go +++ b/internal/app/wwctl/clean/root.go @@ -2,6 +2,7 @@ package clean import ( "github.com/spf13/cobra" + "github.com/warewulf/warewulf/internal/app/wwctl/completions" ) type variables struct { @@ -15,7 +16,8 @@ func GetCommand() *cobra.Command { Short: "Clean up", Long: "This command cleans the OCI cache and removes leftovers from deleted nodes", RunE: CobraRunE(&vars), - Args: cobra.ExactArgs(0), + Args: cobra.NoArgs, + ValidArgsFunction: completions.None, } return baseCmd } diff --git a/internal/app/wwctl/configure/dhcp/root.go b/internal/app/wwctl/configure/dhcp/root.go index 86f9e1b9..73a46fcb 100644 --- a/internal/app/wwctl/configure/dhcp/root.go +++ b/internal/app/wwctl/configure/dhcp/root.go @@ -2,6 +2,7 @@ package dhcp import ( "github.com/spf13/cobra" + "github.com/warewulf/warewulf/internal/app/wwctl/completions" ) var ( @@ -11,8 +12,9 @@ var ( Short: "Manage and initialize DHCP", Long: "DHCP is a dependent service to Warewulf. This command will configure DHCP as defined\n" + "in the warewulf.conf file.", - RunE: CobraRunE, - Args: cobra.ExactArgs(0), + RunE: CobraRunE, + Args: cobra.NoArgs, + ValidArgsFunction: completions.None, } ) diff --git a/internal/app/wwctl/configure/hostfile/root.go b/internal/app/wwctl/configure/hostfile/root.go index 853930b2..8160d19b 100644 --- a/internal/app/wwctl/configure/hostfile/root.go +++ b/internal/app/wwctl/configure/hostfile/root.go @@ -1,6 +1,9 @@ package hostfile -import "github.com/spf13/cobra" +import ( + "github.com/spf13/cobra" + "github.com/warewulf/warewulf/internal/app/wwctl/completions" +) var ( baseCmd = &cobra.Command{ @@ -9,7 +12,8 @@ var ( Short: "update hostfile on master", Long: "Manage the hostfile on the master node\n", RunE: CobraRunE, - Args: cobra.ExactArgs(0), + Args: cobra.NoArgs, + ValidArgsFunction: completions.None, } ) diff --git a/internal/app/wwctl/configure/nfs/root.go b/internal/app/wwctl/configure/nfs/root.go index 5714dec0..eec62275 100644 --- a/internal/app/wwctl/configure/nfs/root.go +++ b/internal/app/wwctl/configure/nfs/root.go @@ -1,6 +1,9 @@ package nfs -import "github.com/spf13/cobra" +import ( + "github.com/spf13/cobra" + "github.com/warewulf/warewulf/internal/app/wwctl/completions" +) var ( baseCmd = &cobra.Command{ @@ -9,8 +12,9 @@ var ( Short: "Manage and initialize NFS", Long: "NFS is an optional dependent service of Warewulf, this tool will automatically\n" + "configure NFS as per the configuration in the warewulf.conf file.", - RunE: CobraRunE, - Args: cobra.ExactArgs(0), + RunE: CobraRunE, + Args: cobra.NoArgs, + ValidArgsFunction: completions.None, } ) diff --git a/internal/app/wwctl/configure/ssh/root.go b/internal/app/wwctl/configure/ssh/root.go index 0ed34ef1..b3fc2784 100644 --- a/internal/app/wwctl/configure/ssh/root.go +++ b/internal/app/wwctl/configure/ssh/root.go @@ -2,6 +2,7 @@ package ssh import ( "github.com/spf13/cobra" + "github.com/warewulf/warewulf/internal/app/wwctl/completions" ) var ( @@ -12,8 +13,9 @@ var ( Long: "SSH is an optionally dependent service for Warewulf, this tool will automatically\n" + "setup the ssh keys nodes using the 'default' system overlay as well as user owned\n" + "keys.", - RunE: CobraRunE, - Args: cobra.ExactArgs(0), + RunE: CobraRunE, + Args: cobra.NoArgs, + ValidArgsFunction: completions.None, } keyTypes []string ) diff --git a/internal/app/wwctl/configure/tftp/root.go b/internal/app/wwctl/configure/tftp/root.go index 9e426924..09ba1f90 100644 --- a/internal/app/wwctl/configure/tftp/root.go +++ b/internal/app/wwctl/configure/tftp/root.go @@ -1,6 +1,9 @@ package tftp -import "github.com/spf13/cobra" +import ( + "github.com/spf13/cobra" + "github.com/warewulf/warewulf/internal/app/wwctl/completions" +) var ( baseCmd = &cobra.Command{ @@ -9,8 +12,9 @@ var ( Short: "Manage and initialize TFTP", Long: "TFTP is a dependent service of Warewulf, this tool will enable the tftp services\n" + "on your Warewulf master.", - RunE: CobraRunE, - Args: cobra.ExactArgs(0), + RunE: CobraRunE, + Args: cobra.NoArgs, + ValidArgsFunction: completions.None, } setShow bool ) diff --git a/internal/app/wwctl/genconf/root.go b/internal/app/wwctl/genconf/root.go index 4a1e2544..2ced1162 100644 --- a/internal/app/wwctl/genconf/root.go +++ b/internal/app/wwctl/genconf/root.go @@ -6,15 +6,18 @@ import ( "github.com/warewulf/warewulf/internal/app/wwctl/genconf/man" "github.com/warewulf/warewulf/internal/app/wwctl/genconf/reference" "github.com/warewulf/warewulf/internal/app/wwctl/genconf/warewulfconf" + + cobraCompletions "github.com/warewulf/warewulf/internal/app/wwctl/completions" ) var ( baseCmd = &cobra.Command{ - Use: "genconfig", - Short: "Generate various configurations", - Long: "This command will allow you to generate different configurations like bash-completions.", - Args: cobra.ExactArgs(0), - Aliases: []string{"cnf"}, + Use: "genconfig", + Short: "Generate various configurations", + Long: "This command will allow you to generate different configurations like bash-completions.", + Args: cobra.NoArgs, + Aliases: []string{"cnf"}, + ValidArgsFunction: cobraCompletions.None, } ListFull bool WWctlRoot *cobra.Command diff --git a/internal/app/wwctl/genconf/warewulfconf/print/root.go b/internal/app/wwctl/genconf/warewulfconf/print/root.go index 656f5e98..a1f7ce0c 100644 --- a/internal/app/wwctl/genconf/warewulfconf/print/root.go +++ b/internal/app/wwctl/genconf/warewulfconf/print/root.go @@ -2,15 +2,17 @@ package print import ( "github.com/spf13/cobra" + "github.com/warewulf/warewulf/internal/app/wwctl/completions" ) var ( baseCmd = &cobra.Command{ - Use: "print", - Short: "print wareweulf.conf", - Long: "This command prints the actual used warewulf.conf, can be used to create an empty valid warewulf.conf", - RunE: CobraRunE, - Args: cobra.ExactArgs(0), + Use: "print", + Short: "print wareweulf.conf", + Long: "This command prints the actual used warewulf.conf, can be used to create an empty valid warewulf.conf", + RunE: CobraRunE, + Args: cobra.NoArgs, + ValidArgsFunction: completions.None, } ) diff --git a/internal/app/wwctl/genconf/warewulfconf/root.go b/internal/app/wwctl/genconf/warewulfconf/root.go index 05732286..085d2f12 100644 --- a/internal/app/wwctl/genconf/warewulfconf/root.go +++ b/internal/app/wwctl/genconf/warewulfconf/root.go @@ -2,16 +2,18 @@ package warewulfconf import ( "github.com/spf13/cobra" + "github.com/warewulf/warewulf/internal/app/wwctl/completions" "github.com/warewulf/warewulf/internal/app/wwctl/genconf/warewulfconf/print" ) var ( baseCmd = &cobra.Command{ - Use: "warewulfconf", - Short: "access warewulf.conf", - Long: "Commands for accessing the actual used warewulf.conf", - Args: cobra.ExactArgs(0), - Aliases: []string{"cnf"}, + Use: "warewulfconf", + Short: "access warewulf.conf", + Long: "Commands for accessing the actual used warewulf.conf", + Args: cobra.NoArgs, + Aliases: []string{"cnf"}, + ValidArgsFunction: completions.None, } ListFull bool WWctlRoot *cobra.Command diff --git a/internal/app/wwctl/server/root.go b/internal/app/wwctl/server/root.go index de4ac47a..dd3f3a00 100644 --- a/internal/app/wwctl/server/root.go +++ b/internal/app/wwctl/server/root.go @@ -5,6 +5,7 @@ import ( "syscall" "github.com/spf13/cobra" + "github.com/warewulf/warewulf/internal/app/wwctl/completions" "github.com/warewulf/warewulf/internal/pkg/warewulfd" ) @@ -14,6 +15,8 @@ var ( Use: "server [OPTIONS]", Short: "Start Warewulf server", RunE: CobraRunE, + Args: cobra.NoArgs, + ValidArgsFunction: completions.None, } ) diff --git a/internal/app/wwctl/version/root.go b/internal/app/wwctl/version/root.go index 4e88e9d9..1e12fbfd 100644 --- a/internal/app/wwctl/version/root.go +++ b/internal/app/wwctl/version/root.go @@ -1,15 +1,19 @@ package version -import "github.com/spf13/cobra" +import ( + "github.com/spf13/cobra" + "github.com/warewulf/warewulf/internal/app/wwctl/completions" +) var ( baseCmd = &cobra.Command{ - Use: "version", - Short: "Version information", - Long: "This command will print the Warewulf version.", - RunE: CobraRunE, - Args: cobra.ExactArgs(0), - Aliases: []string{"vers"}, + Use: "version", + Short: "Version information", + Long: "This command will print the Warewulf version.", + RunE: CobraRunE, + Args: cobra.NoArgs, + Aliases: []string{"vers"}, + ValidArgsFunction: completions.None, } ListFull bool )