From b9d643358ac66b685780d34892fb0729712d8f28 Mon Sep 17 00:00:00 2001 From: Eri Bastos Date: Thu, 8 Mar 2018 17:55:03 -0400 Subject: [PATCH] Skip checking for password file existence if command is 'version' - Issue #1632 --- cmd/restic/main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/restic/main.go b/cmd/restic/main.go index d1f9c5547..44b74afbd 100644 --- a/cmd/restic/main.go +++ b/cmd/restic/main.go @@ -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)