Commit 639b9d1
Changed files (3)
cmd
cmd/generate/generate.go
@@ -1,7 +1,7 @@
package generate
import (
- "fmt"
+ "os"
"github.com/spf13/cobra"
)
@@ -11,6 +11,9 @@ var Cmd = &cobra.Command{
Short: "Generate stuff",
Long: `Generate stuff`,
Run: func(cmd *cobra.Command, args []string) {
- fmt.Println("Please specify subcommand")
+ if len(args) == 0 {
+ cmd.Help()
+ os.Exit(0)
+ }
},
}
cmd/get/get.go
@@ -1,7 +1,7 @@
package get
import (
- "fmt"
+ "os"
"github.com/spf13/cobra"
)
@@ -11,6 +11,9 @@ var Cmd = &cobra.Command{
Short: "Obtain information",
Long: `Obtain information`,
Run: func(cmd *cobra.Command, args []string) {
- fmt.Println("Please specify subcommand")
+ if len(args) == 0 {
+ cmd.Help()
+ os.Exit(0)
+ }
},
}
cmd/root.go
@@ -27,7 +27,6 @@ func Execute() {
}
func init() {
- rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
rootCmd.AddCommand(get.Cmd)
rootCmd.AddCommand(generate.Cmd)
}