root.go 603 B

1234567891011121314151617181920212223242526272829
  1. package host
  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: "device",
  9. Aliases: []string{"host"},
  10. Short: "Manage devices",
  11. Long: `Manage devices`,
  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. }