mirror of
https://github.com/quitesimpleorg/hs9001.git
synced 2025-01-10 12:43:45 +01:00
Compare commits
No commits in common. "e63ad28f74624db82031b8a5a691ae8850e8dd57" and "31973bd5dd5b4b261ae73609e9fa24f02eeea5e3" have entirely different histories.
e63ad28f74
...
31973bd5dd
13
main.go
13
main.go
@ -9,7 +9,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
|
||||||
|
|
||||||
_ "modernc.org/sqlite"
|
_ "modernc.org/sqlite"
|
||||||
)
|
)
|
||||||
@ -119,10 +118,6 @@ func exists(path string) (bool, error) {
|
|||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func printUsage() {
|
|
||||||
fmt.Fprintf(os.Stderr, "Usage: ./hs9001 <add/search/init/import>\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var ret int
|
var ret int
|
||||||
flag.IntVar(&ret, "ret", 0, "Return value of the command to add")
|
flag.IntVar(&ret, "ret", 0, "Return value of the command to add")
|
||||||
@ -131,7 +126,7 @@ func main() {
|
|||||||
argslen := len(args)
|
argslen := len(args)
|
||||||
|
|
||||||
if argslen < 1 {
|
if argslen < 1 {
|
||||||
printUsage()
|
fmt.Fprintf(os.Stderr, "Usage: ./hs9001 <add/search/init/import>\n")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +152,7 @@ func main() {
|
|||||||
if argslen < 2 {
|
if argslen < 2 {
|
||||||
fmt.Fprint(os.Stderr, "Please provide the search query\n")
|
fmt.Fprint(os.Stderr, "Please provide the search query\n")
|
||||||
}
|
}
|
||||||
q := strings.Join(args[1:], " ")
|
q := args[1]
|
||||||
search(conn, q)
|
search(conn, q)
|
||||||
os.Exit(23)
|
os.Exit(23)
|
||||||
} else if cmd == "init" {
|
} else if cmd == "init" {
|
||||||
@ -168,9 +163,5 @@ func main() {
|
|||||||
initDatabase(conn)
|
initDatabase(conn)
|
||||||
} else if cmd == "import" {
|
} else if cmd == "import" {
|
||||||
importFromStdin(conn)
|
importFromStdin(conn)
|
||||||
} else {
|
|
||||||
fmt.Fprint(os.Stderr, "Error: Unknown command supplied\n\n")
|
|
||||||
printUsage()
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user