Skip checking for password file existence if command is 'version' - Issue #1632

This commit is contained in:
Eri Bastos 2018-03-08 17:55:03 -04:00
parent ab5ef600a2
commit b9d643358a
1 changed files with 4 additions and 2 deletions

View File

@ -29,14 +29,16 @@ directories in an encrypted repository stored on different backends.
SilenceUsage: true,
DisableAutoGenTag: true,
PersistentPreRunE: func(*cobra.Command, []string) error {
PersistentPreRunE: func(c *cobra.Command, args []string) error {
// parse extended options
opts, err := options.Parse(globalOptions.Options)
if err != nil {
return err
}
globalOptions.extended = opts
if c.Name() == "version" {
return nil
}
pwd, err := resolvePassword(globalOptions, "RESTIC_PASSWORD")
if err != nil {
fmt.Fprintf(os.Stderr, "Resolving password failed: %v\n", err)