wwctl completions for no args

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2025-02-09 15:28:30 -07:00
parent 760b6e5217
commit 65f85a00a3
11 changed files with 67 additions and 35 deletions

View File

@@ -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
}

View File

@@ -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,
}
)

View File

@@ -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,
}
)

View File

@@ -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,
}
)

View File

@@ -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
)

View File

@@ -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
)

View File

@@ -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

View File

@@ -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,
}
)

View File

@@ -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

View File

@@ -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,
}
)

View File

@@ -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
)