Skip to content

Commit

Permalink
inits details command in CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
mhausenblas committed Nov 28, 2019
1 parent 7122967 commit f635e07
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
23 changes: 23 additions & 0 deletions cmd/fleet/cli/details.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package cli

import (
"fmt"

"github.com/spf13/cobra"
)

// DetailsCmd runs the fleet details command
func DetailsCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "details",
Short: "Details about a cluster in the fleet",
Long: `.`,
SilenceErrors: true,
SilenceUsage: true,
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println("DETAILS")
return nil
},
}
return cmd
}
8 changes: 5 additions & 3 deletions cmd/fleet/cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var (
func RootCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "fleet",
Short: "",
Short: "Info on a fleet of Kubernetes clusters",
Long: `.`,
SilenceErrors: true,
SilenceUsage: true,
Expand All @@ -42,9 +42,11 @@ func RootCmd() *cobra.Command {
return cmd
}

// InitAndExecute sets up and executes the root command
// InitAndExecute sets up and executes fleet commands
func InitAndExecute() {
if err := RootCmd().Execute(); err != nil {
rootCmd := RootCmd()
rootCmd.AddCommand(DetailsCmd())
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
Expand Down

0 comments on commit f635e07

Please sign in to comment.