package cmd import ( "fmt" "os" "github.com/spf13/cobra" ) var cfgFile string // RootCmd represents the base command when called without any subcommands var RootCmd = &cobra.Command{ Use: "ansible-role-version", Short: "Small tool to update a requirements.yml file for Ansible Galaxy", } // Execute adds all child commands to the root command sets flags appropriately. // This is called by main.main(). It only needs to happen once to the rootCmd. func Execute(appVersion string) { version = appVersion if err := RootCmd.Execute(); err != nil { fmt.Println(err) os.Exit(-1) } } func init() { RootCmd.PersistentFlags().StringVarP(&cfg.RolesFile, "roles-file", "f", "requirements.yml", "File containing the requirements") }