Mirror von
https://github.com/quitesimpleorg/hs9001.git
synchronisiert 2025-01-09 17:13:44 +01:00
Commits vergleichen
2 Commits
31973bd5dd
...
e63ad28f74
Autor | SHA1 | Datum | |
---|---|---|---|
e63ad28f74 | |||
eb0612864d |
13
main.go
13
main.go
@ -9,6 +9,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
_ "modernc.org/sqlite"
|
||||
)
|
||||
@ -118,6 +119,10 @@ func exists(path string) (bool, error) {
|
||||
return false, err
|
||||
}
|
||||
|
||||
func printUsage() {
|
||||
fmt.Fprintf(os.Stderr, "Usage: ./hs9001 <add/search/init/import>\n")
|
||||
}
|
||||
|
||||
func main() {
|
||||
var ret int
|
||||
flag.IntVar(&ret, "ret", 0, "Return value of the command to add")
|
||||
@ -126,7 +131,7 @@ func main() {
|
||||
argslen := len(args)
|
||||
|
||||
if argslen < 1 {
|
||||
fmt.Fprintf(os.Stderr, "Usage: ./hs9001 <add/search/init/import>\n")
|
||||
printUsage()
|
||||
return
|
||||
}
|
||||
|
||||
@ -152,7 +157,7 @@ func main() {
|
||||
if argslen < 2 {
|
||||
fmt.Fprint(os.Stderr, "Please provide the search query\n")
|
||||
}
|
||||
q := args[1]
|
||||
q := strings.Join(args[1:], " ")
|
||||
search(conn, q)
|
||||
os.Exit(23)
|
||||
} else if cmd == "init" {
|
||||
@ -163,5 +168,9 @@ func main() {
|
||||
initDatabase(conn)
|
||||
} else if cmd == "import" {
|
||||
importFromStdin(conn)
|
||||
} else {
|
||||
fmt.Fprint(os.Stderr, "Error: Unknown command supplied\n\n")
|
||||
printUsage()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren