[WIP] v0.7.0
Some checks failed
ci/woodpecker/push/go-lint Pipeline failed

This commit is contained in:
2025-01-14 09:42:43 -06:00
parent aee513f786
commit 5c2bfcc940
34 changed files with 1072 additions and 353 deletions

View File

@ -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 {

View File

@ -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()
}

View File

@ -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()
}

View File

@ -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 {

View File

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

View File

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