2023-09-09 04:42:13 +00:00
// backup.go
// Copyright (C) Andrew Woodlee 2023
// License: Apache-2.0
package cmd
import (
"git.andrewnw.xyz/CyberShell/backy/pkg/backy"
"github.com/spf13/cobra"
)
var (
listCmd = & cobra . Command {
Use : "list [--list=list1,list2,... | -l list1, list2,...] [ -cmd cmd1 cmd2 cmd3...]" ,
Short : "Lists commands, lists, or hosts defined in config file." ,
Long : "Backup lists commands or groups defined in config file.\nUse the --lists or -l flag to list the specified lists. If not flag is not given, all lists will be executed." ,
Run : List ,
}
)
var listsToList [ ] string
2024-08-28 20:06:25 +00:00
var cmdsToList [ ] string
2023-09-09 04:42:13 +00:00
func init ( ) {
listCmd . Flags ( ) . StringSliceVarP ( & listsToList , "lists" , "l" , nil , "Accepts comma-separated names of command lists to list." )
2024-08-28 20:06:25 +00:00
listCmd . Flags ( ) . StringSliceVarP ( & cmdsToList , "cmds" , "c" , nil , "Accepts comma-separated names of commands to list." )
2023-09-09 04:42:13 +00:00
}
func List ( cmd * cobra . Command , args [ ] string ) {
2024-08-28 20:06:25 +00:00
// settup based on whats passed in:
// - cmds
// - lists
// - if none, list all commands
if cmdLists != nil {
}
opts := backy . NewOpts ( cfgFile )
2023-09-09 04:42:13 +00:00
opts . InitConfig ( )
opts = backy . ReadConfig ( opts )
2024-08-28 20:06:25 +00:00
opts . ListCommand ( "rm-sn-db" )
2023-09-09 04:42:13 +00:00
}