1
0
Fork 0
mirror of https://github.com/Luzifer/ansible-role-version.git synced 2024-12-23 02:51:20 +00:00
ansible-role-version/cmd/root.go
Knut Ahlers 2db953925e
Migrate to cobra to support more future commands
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2018-01-11 00:02:48 +01:00

30 lines
743 B
Go

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")
}