Added some Cobra framework for new command groups as I'm thinking through the interface.
This commit is contained in:
32
internal/app/wwctl/overlay/list/root.go
Normal file
32
internal/app/wwctl/overlay/list/root.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package list
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
listCmd = &cobra.Command{
|
||||
Use: "list",
|
||||
Short: "List Warewulf Overlays",
|
||||
Long: "Warewulf List overlay",
|
||||
RunE: CobraRunE,
|
||||
}
|
||||
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
}
|
||||
|
||||
// GetRootCommand returns the root cobra.Command for the application.
|
||||
func GetCommand() *cobra.Command {
|
||||
return listCmd
|
||||
}
|
||||
|
||||
|
||||
func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||
|
||||
fmt.Printf("List: Hello World\n")
|
||||
return nil
|
||||
}
|
||||
30
internal/app/wwctl/overlay/root.go
Normal file
30
internal/app/wwctl/overlay/root.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package overlay
|
||||
|
||||
import (
|
||||
"github.com/hpcng/warewulf/internal/app/wwctl/overlay/list"
|
||||
"github.com/hpcng/warewulf/internal/app/wwctl/overlay/show"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
overlayCmd = &cobra.Command{
|
||||
Use: "overlay",
|
||||
Short: "Warewulf Overlay Management",
|
||||
Long: "Management interface for Warewulf overlays",
|
||||
}
|
||||
test bool
|
||||
)
|
||||
|
||||
func init() {
|
||||
overlayCmd.PersistentFlags().BoolVarP(&test, "test", "t", false, "Testing.")
|
||||
|
||||
overlayCmd.AddCommand(list.GetCommand())
|
||||
overlayCmd.AddCommand(show.GetCommand())
|
||||
|
||||
}
|
||||
|
||||
// GetRootCommand returns the root cobra.Command for the application.
|
||||
func GetCommand() *cobra.Command {
|
||||
return overlayCmd
|
||||
}
|
||||
32
internal/app/wwctl/overlay/show/root.go
Normal file
32
internal/app/wwctl/overlay/show/root.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package show
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
showCmd = &cobra.Command{
|
||||
Use: "show",
|
||||
Short: "Show Warewulf Overlay objects",
|
||||
Long: "Warewulf show overlay objects",
|
||||
RunE: CobraRunE,
|
||||
}
|
||||
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
}
|
||||
|
||||
// GetRootCommand returns the root cobra.Command for the application.
|
||||
func GetCommand() *cobra.Command {
|
||||
return showCmd
|
||||
}
|
||||
|
||||
|
||||
func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||
|
||||
fmt.Printf("Show: Hello World\n")
|
||||
return nil
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package wwctl
|
||||
|
||||
import (
|
||||
"github.com/hpcng/warewulf/internal/app/wwctl/build"
|
||||
"github.com/hpcng/warewulf/internal/app/wwctl/overlay"
|
||||
"github.com/hpcng/warewulf/internal/pkg/wwlog"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
@@ -22,6 +23,7 @@ func init() {
|
||||
rootCmd.PersistentFlags().BoolVarP(&debugArg, "debug", "d", false, "Run with debugging messages enabled.")
|
||||
|
||||
rootCmd.AddCommand(build.GetCommand())
|
||||
rootCmd.AddCommand(overlay.GetCommand())
|
||||
}
|
||||
|
||||
// GetRootCommand returns the root cobra.Command for the application.
|
||||
|
||||
Reference in New Issue
Block a user