This commit is contained in:
@ -31,8 +31,7 @@ func init() {
|
||||
func Backup(cmd *cobra.Command, args []string) {
|
||||
backyConfOpts := backy.NewOpts(cfgFile, backy.AddCommandLists(cmdLists))
|
||||
backyConfOpts.InitConfig()
|
||||
|
||||
backy.ReadConfig(backyConfOpts)
|
||||
backyConfOpts.ReadConfig()
|
||||
|
||||
backyConfOpts.RunListConfig("")
|
||||
for _, host := range backyConfOpts.Hosts {
|
||||
|
@ -19,6 +19,7 @@ func cron(cmd *cobra.Command, args []string) {
|
||||
|
||||
opts := backy.NewOpts(cfgFile, backy.CronEnabled())
|
||||
opts.InitConfig()
|
||||
backy.ReadConfig(opts)
|
||||
opts.ReadConfig()
|
||||
|
||||
opts.Cron()
|
||||
}
|
||||
|
@ -33,8 +33,8 @@ func execute(cmd *cobra.Command, args []string) {
|
||||
logging.ExitWithMSG("Please provide a command to run. Pass --help to see options.", 1, nil)
|
||||
}
|
||||
|
||||
opts := backy.NewOpts(cfgFile, backy.AddCommands(args))
|
||||
opts := backy.NewOpts(cfgFile, backy.AddCommands(args), backy.SetLogFile(logFile))
|
||||
opts.InitConfig()
|
||||
// opts.InitMongo()
|
||||
backy.ReadConfig(opts).ExecuteCmds(opts)
|
||||
opts.ReadConfig()
|
||||
opts.ExecuteCmds()
|
||||
}
|
||||
|
@ -29,10 +29,10 @@ func init() {
|
||||
// 2. stdin (on command line) (TODO)
|
||||
|
||||
func Host(cmd *cobra.Command, args []string) {
|
||||
backyConfOpts := backy.NewOpts(cfgFile)
|
||||
backyConfOpts := backy.NewOpts(cfgFile, backy.SetLogFile(logFile))
|
||||
backyConfOpts.InitConfig()
|
||||
|
||||
backy.ReadConfig(backyConfOpts)
|
||||
backyConfOpts.ReadConfig()
|
||||
|
||||
// check CLI input
|
||||
if hostsList == nil {
|
||||
|
@ -31,7 +31,7 @@ func init() {
|
||||
|
||||
func List(cmd *cobra.Command, args []string) {
|
||||
|
||||
// settup based on whats passed in:
|
||||
// setup based on whats passed in:
|
||||
// - cmds
|
||||
// - lists
|
||||
// - if none, list all commands
|
||||
@ -42,8 +42,7 @@ func List(cmd *cobra.Command, args []string) {
|
||||
opts := backy.NewOpts(cfgFile)
|
||||
|
||||
opts.InitConfig()
|
||||
|
||||
opts = backy.ReadConfig(opts)
|
||||
opts.ReadConfig()
|
||||
|
||||
opts.ListCommand("rm-sn-db")
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ var (
|
||||
// Used for flags.
|
||||
cfgFile string
|
||||
verbose bool
|
||||
logFile string
|
||||
|
||||
rootCmd = &cobra.Command{
|
||||
Use: "backy",
|
||||
@ -33,6 +34,8 @@ func Execute() {
|
||||
|
||||
func init() {
|
||||
|
||||
rootCmd.PersistentFlags().StringVar(&logFile, "log-file", "", "log file to write to")
|
||||
|
||||
rootCmd.PersistentFlags().StringVarP(&cfgFile, "config", "f", "", "config file to read from")
|
||||
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Sets verbose level")
|
||||
|
||||
|
Reference in New Issue
Block a user