Progress on sub-commands, added unmarshalling
This commit is contained in:
28
cmd/backup.go
Normal file
28
cmd/backup.go
Normal 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()
|
||||
}
|
@ -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() {
|
||||
|
Reference in New Issue
Block a user