mirror of
https://github.com/cupcakearmy/autorestic.git
synced 2026-04-02 20:05:23 +00:00
dont duplicate global flags (#187)
This commit is contained in:
@@ -295,12 +295,8 @@ func appendOptionsToSlice(str *[]string, options OptionMap) {
|
||||
}
|
||||
}
|
||||
|
||||
func getOptions(options Options, key string) []string {
|
||||
func getOptions(options Options, keys []string) []string {
|
||||
var selected []string
|
||||
var keys = []string{"all"}
|
||||
if key != "" {
|
||||
keys = append(keys, key)
|
||||
}
|
||||
for _, key := range keys {
|
||||
appendOptionsToSlice(&selected, options[key])
|
||||
}
|
||||
@@ -310,9 +306,9 @@ func getOptions(options Options, key string) []string {
|
||||
func combineOptions(key string, l Location, b Backend) []string {
|
||||
// Priority: location > backend > global
|
||||
var options []string
|
||||
gFlags := getOptions(GetConfig().Global, key)
|
||||
bFlags := getOptions(b.Options, key)
|
||||
lFlags := getOptions(l.Options, key)
|
||||
gFlags := getOptions(GetConfig().Global, []string{key})
|
||||
bFlags := getOptions(b.Options, []string{"all", key})
|
||||
lFlags := getOptions(l.Options, []string{"all", key})
|
||||
options = append(options, gFlags...)
|
||||
options = append(options, bFlags...)
|
||||
options = append(options, lFlags...)
|
||||
|
||||
@@ -81,7 +81,7 @@ func ExecuteCommand(options ExecuteOptions, args ...string) (int, string, error)
|
||||
func ExecuteResticCommand(options ExecuteOptions, args ...string) (int, string, error) {
|
||||
options.Command = RESTIC_BIN
|
||||
var c = GetConfig()
|
||||
var optionsAsString = getOptions(c.Global, "")
|
||||
var optionsAsString = getOptions(c.Global, []string{"all"})
|
||||
args = append(optionsAsString, args...)
|
||||
return ExecuteCommand(options, args...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user