Author: Adam <git@apiote.tk>
add non-interactive mode
eeze.go | 5 +++++ server/sync.go | 2 +-
diff --git a/eeze.go b/eeze.go index 1986f222aca699476ca755f00bb99c36514f65ad..1f01072f741290b8344fc1ef75fc59c1715f77e6 100644 --- a/eeze.go +++ b/eeze.go @@ -31,6 +31,7 @@ f := getopt.Bool("f", false, "show full entry in Get, instead of just username/password") p := getopt.Bool("p", false, "show just password in Get") i := getopt.Bool("i", false, "in Config: set server, username, password (initialise)") r := getopt.Bool("r", false, "in Config: reëncrypt (change master password)") + n := getopt.Bool("n", false, "do not ask for anything, fail if password cannot be obtained from agent") err := getopt.Parse() if err != nil { @@ -42,6 +43,10 @@ masterPassword, err := agent.GetMasterPassword() if err != nil { log.Println("Error getting from agent", err) agent.StartAgent() + } + + if masterPassword == "" && !*C && *n { + log.Fatalln("Password needed in non-interactive mode") } if masterPassword == "" || (*C && (*i || *r)) { diff --git a/server/sync.go b/server/sync.go index 89e6da881e2e7626cd3cb3498132ba3bfba0cb4d..e16920c19d57361a784d96e5db517874bf0495e0 100644 --- a/server/sync.go +++ b/server/sync.go @@ -58,7 +58,7 @@ log.Fatal("Error unmarshalling body. ", err) return "", err } if !sessionResult.Success { - log.Fatal("Error authenticating body.") + log.Fatal("Error authenticating.") return "", errors.New("No success") }