root.go 1004 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package ext_client
  2. import (
  3. "os"
  4. "github.com/spf13/cobra"
  5. )
  6. // rootCmd represents the base command when called without any subcommands
  7. var rootCmd = &cobra.Command{
  8. Use: "ext_client",
  9. Short: "Manage External Clients",
  10. Long: `Manage External Clients`,
  11. // Run: func(cmd *cobra.Command, args []string) { },
  12. }
  13. // GetRoot returns the root subcommand
  14. func GetRoot() *cobra.Command {
  15. return rootCmd
  16. }
  17. // Execute adds all child commands to the root command and sets flags appropriately.
  18. // This is called by main.main(). It only needs to happen once to the rootCmd.
  19. func Execute() {
  20. err := rootCmd.Execute()
  21. if err != nil {
  22. os.Exit(1)
  23. }
  24. }
  25. func init() {
  26. // Here you will define your flags and configuration settings.
  27. // Cobra supports persistent flags, which, if defined here,
  28. // will be global for your application.
  29. // Cobra also supports local flags, which will only run
  30. // when this action is called directly.
  31. rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
  32. }