mirror of
https://github.com/cupcakearmy/autorestic.git
synced 2024-12-22 08:16:25 +00:00
parent
2f407cf211
commit
6990bf6adc
17
cmd/exec.go
17
cmd/exec.go
@ -1,6 +1,8 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/cupcakearmy/autorestic/internal"
|
"github.com/cupcakearmy/autorestic/internal"
|
||||||
"github.com/cupcakearmy/autorestic/internal/colors"
|
"github.com/cupcakearmy/autorestic/internal/colors"
|
||||||
"github.com/cupcakearmy/autorestic/internal/lock"
|
"github.com/cupcakearmy/autorestic/internal/lock"
|
||||||
@ -18,10 +20,23 @@ var execCmd = &cobra.Command{
|
|||||||
|
|
||||||
selected, err := internal.GetAllOrSelected(cmd, true)
|
selected, err := internal.GetAllOrSelected(cmd, true)
|
||||||
CheckErr(err)
|
CheckErr(err)
|
||||||
|
|
||||||
|
var errors []error
|
||||||
for _, name := range selected {
|
for _, name := range selected {
|
||||||
colors.PrimaryPrint(" Executing on \"%s\" ", name)
|
colors.PrimaryPrint(" Executing on \"%s\" ", name)
|
||||||
backend, _ := internal.GetBackend(name)
|
backend, _ := internal.GetBackend(name)
|
||||||
backend.Exec(args)
|
err := backend.Exec(args)
|
||||||
|
if err != nil {
|
||||||
|
errors = append(errors, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(errors) > 0 {
|
||||||
|
for _, err := range errors {
|
||||||
|
colors.Error.Printf("%s\n\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
CheckErr(fmt.Errorf("%d errors were found", len(errors)))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user