Progress on sub-commands, added unmarshalling

This commit is contained in:
2023-01-09 22:18:56 -06:00
parent ae87ccb4b5
commit 15a7ca6c3d
4 changed files with 190 additions and 116 deletions

28
cmd/backup.go Normal file
View File

@ -0,0 +1,28 @@
package cmd
import (
"git.andrewnw.xyz/CyberShell/backy/pkg/backy"
"github.com/spf13/cobra"
)
var (
backupCmd = &cobra.Command{
Use: "backup [--commands==list1,list2]",
Short: "Runs commands defined in config file.",
Long: `Backup executes commands defined in config file,
use the -cmds flag to execute the specified commands.`,
}
)
var CmdList *[]string
func init() {
cobra.OnInitialize(initConfig)
backupCmd.Flags().StringSliceVarP(CmdList, "commands", "cmds", nil, "Accepts a comma-separated list of command lists to execute.")
}
func backup() {
backyConfig := backy.NewOpts(cfgFile)
backyConfig.GetConfig()
}

View File

@ -32,7 +32,7 @@ func init() {
rootCmd.PersistentFlags().StringVarP(&cfgFile, "config", "c", "", "config file to read from")
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Sets verbose level")
rootCmd.PersistentFlags().Bool("viper", true, "use Viper for configuration")
}
func initConfig() {