fix: error out if repoPath doesn't exist

See https://github.com/ssb-ngi-pointer/go-ssb-room/issues/275.
This commit is contained in:
decentral1se 2022-04-06 12:34:18 +02:00 committed by André Staltz
parent 114f1682a3
commit c87a69f907
1 changed files with 7 additions and 0 deletions

View File

@ -53,6 +53,13 @@ func main() {
})
flag.Parse()
if _, err := os.Stat(repoPath); err != nil {
if os.IsNotExist(err) {
fmt.Fprintf(os.Stderr, "error: %s does not exist (-repo)?\n", repoPath)
os.Exit(1)
}
}
// we require one more argument which is not a flag.
if len(flag.Args()) != 1 {
cliMissingArguments("please provide a public key")