package cmd
import (
"fmt"
"os"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "{{ project_name }}",
Short: "{{ description }}",
}
var helloCmd = &cobra.Command{
Use: "hello",
Short: "Say hello",
Run: func(cmd *cobra.Command, args []string) {
name, _ := cmd.Flags().GetString("name")
fmt.Printf("Hello, %s!\n", name)
},
}
func init() {
helloCmd.Flags().StringP("name", "n", "world", "Name to greet")
rootCmd.AddCommand(helloCmd)
}
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}