Created template for server process subcommands
This commit is contained in:
@@ -7,17 +7,16 @@ import (
|
||||
|
||||
var (
|
||||
baseCmd = &cobra.Command{
|
||||
Use: "warewulfd",
|
||||
Short: "Warewulf Daemon Service",
|
||||
Long: "This is the primary Warewulf service for provisioning nodes",
|
||||
RunE: CobraRunE,
|
||||
PersistentPreRunE: rootPersistentPreRunE,
|
||||
Use: "warewulfd",
|
||||
Short: "Warewulf Daemon Service",
|
||||
Long: "This is the primary Warewulf system for provisioning nodes",
|
||||
RunE: CobraRunE,
|
||||
PersistentPreRunE: rootPersistentPreRunE,
|
||||
}
|
||||
verboseArg bool
|
||||
debugArg bool
|
||||
debugArg bool
|
||||
)
|
||||
|
||||
|
||||
func init() {
|
||||
baseCmd.PersistentFlags().BoolVarP(&verboseArg, "verbose", "v", false, "Run with increased verbosity.")
|
||||
baseCmd.PersistentFlags().BoolVarP(&debugArg, "debug", "d", false, "Run with debugging messages enabled.")
|
||||
@@ -37,4 +36,4 @@ func rootPersistentPreRunE(cmd *cobra.Command, args []string) error {
|
||||
wwlog.SetLevel(wwlog.INFO)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,11 @@ import "github.com/spf13/cobra"
|
||||
|
||||
var (
|
||||
baseCmd = &cobra.Command{
|
||||
Use: "__child",
|
||||
Hidden: true,
|
||||
RunE: CobraRunE,
|
||||
Args: cobra.MinimumNArgs(1),
|
||||
Use: "__child",
|
||||
Hidden: true,
|
||||
RunE: CobraRunE,
|
||||
Args: cobra.MinimumNArgs(1),
|
||||
FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true},
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -7,11 +7,12 @@ import (
|
||||
|
||||
var (
|
||||
baseCmd = &cobra.Command{
|
||||
Use: "exec",
|
||||
Short: "Spawn any command inside a Warewulf container",
|
||||
Long: "Run a command inside a Warewulf container ",
|
||||
RunE: CobraRunE,
|
||||
Args: cobra.MinimumNArgs(1),
|
||||
Use: "exec",
|
||||
Short: "Spawn any command inside a Warewulf container",
|
||||
Long: "Run a command inside a Warewulf container ",
|
||||
RunE: CobraRunE,
|
||||
Args: cobra.MinimumNArgs(1),
|
||||
FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true},
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
20
internal/app/wwctl/server/root.go
Normal file
20
internal/app/wwctl/server/root.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package server
|
||||
|
||||
import "github.com/spf13/cobra"
|
||||
|
||||
var (
|
||||
baseCmd = &cobra.Command{
|
||||
Use: "server",
|
||||
Short: "Warewulf server process commands",
|
||||
Long: "Warewulf profiles...",
|
||||
}
|
||||
test bool
|
||||
)
|
||||
|
||||
func init() {
|
||||
}
|
||||
|
||||
// GetRootCommand returns the root cobra.Command for the application.
|
||||
func GetCommand() *cobra.Command {
|
||||
return baseCmd
|
||||
}
|
||||
8
internal/app/wwctl/server/start/main.go
Normal file
8
internal/app/wwctl/server/start/main.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package start
|
||||
|
||||
import "github.com/spf13/cobra"
|
||||
|
||||
func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
20
internal/app/wwctl/server/start/root.go
Normal file
20
internal/app/wwctl/server/start/root.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package start
|
||||
|
||||
import "github.com/spf13/cobra"
|
||||
|
||||
var (
|
||||
baseCmd = &cobra.Command{
|
||||
Use: "start",
|
||||
Short: "Start Warewulf server",
|
||||
Long: "Warewulf Server ",
|
||||
RunE: CobraRunE,
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
}
|
||||
|
||||
// GetRootCommand returns the root cobra.Command for the application.
|
||||
func GetCommand() *cobra.Command {
|
||||
return baseCmd
|
||||
}
|
||||
8
internal/app/wwctl/server/status/main.go
Normal file
8
internal/app/wwctl/server/status/main.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package status
|
||||
|
||||
import "github.com/spf13/cobra"
|
||||
|
||||
func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
20
internal/app/wwctl/server/status/root.go
Normal file
20
internal/app/wwctl/server/status/root.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package status
|
||||
|
||||
import "github.com/spf13/cobra"
|
||||
|
||||
var (
|
||||
baseCmd = &cobra.Command{
|
||||
Use: "status",
|
||||
Short: "Warewulf server status",
|
||||
Long: "Warewulf Server ",
|
||||
RunE: CobraRunE,
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
}
|
||||
|
||||
// GetRootCommand returns the root cobra.Command for the application.
|
||||
func GetCommand() *cobra.Command {
|
||||
return baseCmd
|
||||
}
|
||||
8
internal/app/wwctl/server/stop/main.go
Normal file
8
internal/app/wwctl/server/stop/main.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package stop
|
||||
|
||||
import "github.com/spf13/cobra"
|
||||
|
||||
func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
20
internal/app/wwctl/server/stop/root.go
Normal file
20
internal/app/wwctl/server/stop/root.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package stop
|
||||
|
||||
import "github.com/spf13/cobra"
|
||||
|
||||
var (
|
||||
baseCmd = &cobra.Command{
|
||||
Use: "stop",
|
||||
Short: "Stop Warewulf server",
|
||||
Long: "Warewulf Server ",
|
||||
RunE: CobraRunE,
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
}
|
||||
|
||||
// GetRootCommand returns the root cobra.Command for the application.
|
||||
func GetCommand() *cobra.Command {
|
||||
return baseCmd
|
||||
}
|
||||
Reference in New Issue
Block a user