|
|
@ -78,17 +78,6 @@ func (l Location) validate(c *Config) error {
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (l Location) getOptions(key string) []string {
|
|
|
|
|
|
|
|
var options []string
|
|
|
|
|
|
|
|
saved := l.Options[key]
|
|
|
|
|
|
|
|
for k, values := range saved {
|
|
|
|
|
|
|
|
for _, value := range values {
|
|
|
|
|
|
|
|
options = append(options, fmt.Sprintf("--%s", k), value)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return options
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func ExecuteHooks(commands []string, options ExecuteOptions) error {
|
|
|
|
func ExecuteHooks(commands []string, options ExecuteOptions) error {
|
|
|
|
if len(commands) == 0 {
|
|
|
|
if len(commands) == 0 {
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
@ -164,9 +153,11 @@ func (l Location) Backup(cron bool) []error {
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
flags := l.getOptions("backup")
|
|
|
|
lFlags := getOptions(l.Options, "backup")
|
|
|
|
|
|
|
|
bFlags := getOptions(backend.Options, "backup")
|
|
|
|
cmd := []string{"backup"}
|
|
|
|
cmd := []string{"backup"}
|
|
|
|
cmd = append(cmd, flags...)
|
|
|
|
cmd = append(cmd, lFlags...)
|
|
|
|
|
|
|
|
cmd = append(cmd, bFlags...)
|
|
|
|
if cron {
|
|
|
|
if cron {
|
|
|
|
cmd = append(cmd, "--tag", "cron")
|
|
|
|
cmd = append(cmd, "--tag", "cron")
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -232,7 +223,8 @@ func (l Location) Forget(prune bool, dry bool) error {
|
|
|
|
options := ExecuteOptions{
|
|
|
|
options := ExecuteOptions{
|
|
|
|
Envs: env,
|
|
|
|
Envs: env,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
flags := l.getOptions("forget")
|
|
|
|
lFlags := getOptions(l.Options, "forget")
|
|
|
|
|
|
|
|
bFlags := getOptions(backend.Options, "forget")
|
|
|
|
cmd := []string{"forget", "--path", path}
|
|
|
|
cmd := []string{"forget", "--path", path}
|
|
|
|
if prune {
|
|
|
|
if prune {
|
|
|
|
cmd = append(cmd, "--prune")
|
|
|
|
cmd = append(cmd, "--prune")
|
|
|
@ -240,7 +232,8 @@ func (l Location) Forget(prune bool, dry bool) error {
|
|
|
|
if dry {
|
|
|
|
if dry {
|
|
|
|
cmd = append(cmd, "--dry-run")
|
|
|
|
cmd = append(cmd, "--dry-run")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cmd = append(cmd, flags...)
|
|
|
|
cmd = append(cmd, lFlags...)
|
|
|
|
|
|
|
|
cmd = append(cmd, bFlags...)
|
|
|
|
out, err := ExecuteResticCommand(options, cmd...)
|
|
|
|
out, err := ExecuteResticCommand(options, cmd...)
|
|
|
|
if VERBOSE {
|
|
|
|
if VERBOSE {
|
|
|
|
colors.Faint.Println(out)
|
|
|
|
colors.Faint.Println(out)
|
|
|
|