root.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package network
  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: "network",
  9. Short: "Manage Netmaker Networks",
  10. Long: `Manage Netmaker Networks`,
  11. // Uncomment the following line if your bare application
  12. // has an action associated with it:
  13. // Run: func(cmd *cobra.Command, args []string) { },
  14. }
  15. // GetRoot returns the root subcommand
  16. func GetRoot() *cobra.Command {
  17. return rootCmd
  18. }
  19. // Execute adds all child commands to the root command and sets flags appropriately.
  20. // This is called by main.main(). It only needs to happen once to the rootCmd.
  21. func Execute() {
  22. err := rootCmd.Execute()
  23. if err != nil {
  24. os.Exit(1)
  25. }
  26. }
  27. func init() {
  28. // Here you will define your flags and configuration settings.
  29. // Cobra supports persistent flags, which, if defined here,
  30. // will be global for your application.
  31. // Cobra also supports local flags, which will only run
  32. // when this action is called directly.
  33. rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
  34. }