Skip to content
Snippets Groups Projects
Commit 3b52234d authored by ale's avatar ale
Browse files

the --book-dir option is mandatory

parent d36636cc
Branches
Tags
No related merge requests found
......@@ -193,9 +193,9 @@ func b2i(b bool) int {
}
func expandTilde(path string) string {
if path[:2] == "~/" {
if strings.HasPrefix(path, "~/") {
curUser, _ := user.Current()
return filepath.Join(curUser.HomeDir, path[2:len(path)])
return filepath.Join(curUser.HomeDir, strings.TrimPrefix(path, "~/"))
}
return path
}
......@@ -207,8 +207,8 @@ func main() {
if nset != 1 {
log.Fatal("Must specify one of --update, --sync, --search or --http-server")
}
if *update && *bookDir == "" {
log.Fatal("Must specify --book-dir with --update")
if *bookDir == "" {
log.Fatal("Must specify --book-dir")
}
dbdir := expandTilde(*databaseDir)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment