Require repository

This commit is contained in:
Alexander Neumann 2014-11-23 23:19:47 +01:00
parent 79a1ad50ee
commit 725e5bfca5
1 changed files with 5 additions and 3 deletions

View File

@ -140,15 +140,17 @@ func main() {
log.SetOutput(os.Stdout)
opts.Repo = os.Getenv("KHEPRI_REPOSITORY")
if opts.Repo == "" {
opts.Repo = "khepri-backup"
}
args, err := flags.Parse(&opts)
if e, ok := err.(*flags.Error); ok && e.Type == flags.ErrHelp {
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 {
cmds := []string{"init"}
for k := range commands {