diff --git a/CHANGELOG.md b/CHANGELOG.md index 4925b0c..adfa02e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.2] - 2021-08-05 + +### Added + +- Community page +- Support for yaml references and aliases + +### Fixed + +- Better verbose output for hooks +- Better error message for bad formatted configs + ## [1.1.2] - 2021-07-11 ### Fixes diff --git a/cmd/backup.go b/cmd/backup.go index 8a02bc9..53c875d 100644 --- a/cmd/backup.go +++ b/cmd/backup.go @@ -13,12 +13,11 @@ var backupCmd = &cobra.Command{ Use: "backup", Short: "Create backups for given locations", Run: func(cmd *cobra.Command, args []string) { + internal.GetConfig() err := lock.Lock() CheckErr(err) defer lock.Unlock() - internal.GetConfig() - selected, err := internal.GetAllOrSelected(cmd, false) CheckErr(err) errors := 0 diff --git a/cmd/exec.go b/cmd/exec.go index 6b3fa67..1614fda 100644 --- a/cmd/exec.go +++ b/cmd/exec.go @@ -11,12 +11,11 @@ var execCmd = &cobra.Command{ Use: "exec", Short: "Execute arbitrary native restic commands for given backends", Run: func(cmd *cobra.Command, args []string) { + internal.GetConfig() err := lock.Lock() CheckErr(err) defer lock.Unlock() - internal.GetConfig() - selected, err := internal.GetAllOrSelected(cmd, true) CheckErr(err) for _, name := range selected { diff --git a/cmd/forget.go b/cmd/forget.go index 7010ff0..93d7137 100644 --- a/cmd/forget.go +++ b/cmd/forget.go @@ -10,12 +10,11 @@ var forgetCmd = &cobra.Command{ Use: "forget", Short: "Forget and optionally prune snapshots according the specified policies", Run: func(cmd *cobra.Command, args []string) { + internal.GetConfig() err := lock.Lock() CheckErr(err) defer lock.Unlock() - internal.GetConfig() - selected, err := internal.GetAllOrSelected(cmd, false) CheckErr(err) prune, _ := cmd.Flags().GetBool("prune") diff --git a/internal/config.go b/internal/config.go index cbdb592..847be51 100644 --- a/internal/config.go +++ b/internal/config.go @@ -2,17 +2,20 @@ package internal import ( "fmt" + "os" "path" + "path/filepath" "strings" "sync" "github.com/cupcakearmy/autorestic/internal/colors" + "github.com/cupcakearmy/autorestic/internal/lock" "github.com/mitchellh/go-homedir" "github.com/spf13/cobra" "github.com/spf13/viper" ) -const VERSION = "1.1.2" +const VERSION = "1.2" var CI bool = false var VERBOSE bool = false @@ -32,7 +35,8 @@ func GetConfig() *Config { once.Do(func() { if err := viper.ReadInConfig(); err == nil { if !CRON_LEAN { - colors.Faint.Println("Using config file:", viper.ConfigFileUsed()) + absConfig, _ := filepath.Abs(viper.ConfigFileUsed()) + colors.Faint.Println("Using config file:", absConfig) } } else { return @@ -40,7 +44,9 @@ func GetConfig() *Config { config = &Config{} if err := viper.UnmarshalExact(config); err != nil { - panic(err) + colors.Error.Println("Could not parse config file!") + lock.Unlock() + os.Exit(1) } }) }