2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-25 22:27:35 +00:00

Require repository

This commit is contained in:
Alexander Neumann 2014-11-23 23:19:47 +01:00
parent 79a1ad50ee
commit 725e5bfca5

View File

@ -140,15 +140,17 @@ func main() {
log.SetOutput(os.Stdout) log.SetOutput(os.Stdout)
opts.Repo = os.Getenv("KHEPRI_REPOSITORY") opts.Repo = os.Getenv("KHEPRI_REPOSITORY")
if opts.Repo == "" {
opts.Repo = "khepri-backup"
}
args, err := flags.Parse(&opts) args, err := flags.Parse(&opts)
if e, ok := err.(*flags.Error); ok && e.Type == flags.ErrHelp { if e, ok := err.(*flags.Error); ok && e.Type == flags.ErrHelp {
os.Exit(0) os.Exit(0)
} }
if opts.Repo == "" {
fmt.Fprintf(os.Stderr, "no repository specified, use -r or KHEPRI_REPOSITORY variable\n")
os.Exit(1)
}
if len(args) == 0 { if len(args) == 0 {
cmds := []string{"init"} cmds := []string{"init"}
for k := range commands { for k := range commands {