| 12345678910111213141516171819202122232425262728293031323334353637 |
- package cmd
- import (
- "errors"
- "fmt"
- "github.com/spf13/cobra"
- "os"
- )
- var rootCmd = &cobra.Command{
- Use: "gofly",
- Short: "gofly",
- Long: `简洁快速的GO语言WEB在线客服`,
- Args: args,
- Run: func(cmd *cobra.Command, args []string) {
- },
- }
- func args(cmd *cobra.Command, args []string) error {
- if len(args) < 1 {
- return errors.New("至少需要一个参数!")
- }
- return nil
- }
- func Execute() {
- if err := rootCmd.Execute(); err != nil {
- fmt.Println(err)
- os.Exit(1)
- }
- }
- func init() {
- rootCmd.AddCommand(versionCmd)
- rootCmd.AddCommand(serverCmd)
- rootCmd.AddCommand(installCmd)
- }
|