command.go 331 B

12345678910111213141516171819202122232425
  1. package cmd
  2. import (
  3. "fmt"
  4. "github.com/spf13/cobra"
  5. "ppgo/common"
  6. )
  7. var CommandCmd = &cobra.Command{
  8. Use: "cmd",
  9. Short: "run a cmd",
  10. Long: `run a cmd`,
  11. Run: RunCmd,
  12. }
  13. func init() {
  14. RootCmd.AddCommand(CommandCmd)
  15. }
  16. func RunCmd(cmd *cobra.Command, args []string) {
  17. c := common.GetConfig()
  18. fmt.Printf("%+v", c)
  19. }