error handling for upgrade and uninstall

This commit is contained in:
2021-10-30 14:50:27 +02:00
parent 11d1da7468
commit 8c30134f7c
2 changed files with 19 additions and 11 deletions

View File

@@ -9,13 +9,13 @@ var upgradeCmd = &cobra.Command{
Use: "upgrade",
Short: "Upgrade autorestic and restic",
Run: func(cmd *cobra.Command, args []string) {
noRestic, _ := cmd.Flags().GetBool("no-restic")
err := bins.Upgrade(!noRestic)
restic, _ := cmd.Flags().GetBool("restic")
err := bins.Upgrade(restic)
CheckErr(err)
},
}
func init() {
rootCmd.AddCommand(upgradeCmd)
upgradeCmd.Flags().Bool("no-restic", false, "also update restic")
upgradeCmd.Flags().Bool("restic", true, "also update restic")
}