This commit is contained in:
Alexander Neumann 2018-05-04 00:24:37 +02:00
parent 1fbcf63830
commit 0c078cc205
2 changed files with 4 additions and 5 deletions

View File

@ -43,7 +43,6 @@ var version = "compiled manually"
type GlobalOptions struct {
config.Config
PasswordFile string
Quiet bool
Verbose int
NoLock bool
@ -91,8 +90,8 @@ func init() {
// these fields are embedded in config.Config and queried via f.Get[...]()
f.StringP("repo", "r", "", "repository to backup to or restore from (default: $RESTIC_REPOSITORY)")
f.StringP("password-file", "p", "", "read the repository password from a file (default: $RESTIC_PASSWORD_FILE)")
f.StringVarP(&globalOptions.PasswordFile, "password-file", "p", os.Getenv("RESTIC_PASSWORD_FILE"), "read the repository password from a file (default: $RESTIC_PASSWORD_FILE)")
f.BoolVarP(&globalOptions.Quiet, "quiet", "q", false, "do not output comprehensive progress report")
f.CountVarP(&globalOptions.Verbose, "verbose", "v", "be verbose (specify --verbose multiple times or level `n`)")
f.BoolVar(&globalOptions.NoLock, "no-lock", false, "do not lock the repo, this allows some operations on read-only repos")

View File

@ -15,9 +15,9 @@ import (
// Config contains configuration items read from a file.
type Config struct {
Repo string `config:"repo" flag:"repo" env:"RESTIC_REPOSITORY"`
Password string `config:"password" env:"RESTIC_PASSWORD"`
PasswordFile string `config:`
Repo string `config:"repo" flag:"repo" env:"RESTIC_REPOSITORY"`
Password string `config:"password" env:"RESTIC_PASSWORD"`
PasswordFile string `config:"password_file" flag:"password-file" env:"RESTIC_PASSWORD_FILE"`
Backends map[string]Backend `config:"backend"`
Backup *Backup `config:"backup"`