mirror of
https://github.com/Luzifer/ansible-role-version.git
synced 2024-12-23 02:51:20 +00:00
31 lines
743 B
Go
31 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")
|
||
|
}
|