diff options
| author | JP Appel <jeanpierre.appel01@gmail.com> | 2025-07-02 02:11:26 -0400 |
|---|---|---|
| committer | JP Appel <jeanpierre.appel01@gmail.com> | 2025-07-02 02:11:26 -0400 |
| commit | d67596acd921f75caaa4e604bc1ccf163bd0729e (patch) | |
| tree | d7d0d30d20a1a63173acc183e3edd4163a82bc1d /cmd/atlas.go | |
| parent | 3b3fc9ebfce6e0944b12b929b6abc95251a0e64e (diff) | |
Add experimental http server
Diffstat (limited to 'cmd/atlas.go')
| -rw-r--r-- | cmd/atlas.go | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/cmd/atlas.go b/cmd/atlas.go index a641521..4474c7e 100644 --- a/cmd/atlas.go +++ b/cmd/atlas.go @@ -44,10 +44,11 @@ func printHelp() { fmt.Println("atlas is a note indexing and querying tool") fmt.Printf("\nUsage:\n %s [global-flags] <command>\n\n", os.Args[0]) fmt.Println("Commands:") - fmt.Println(" index - build, update, or modify the index") - fmt.Println(" query - search against the index") - fmt.Println(" shell - start a debug query shell") - fmt.Println(" help - print this help then exit") + fmt.Println(" index - build, update, or modify the index") + fmt.Println(" query - search against the index") + fmt.Println(" shell - start a debug shell") + fmt.Println(" server - start an http query server (EXPERIMENTAL)") + fmt.Println(" help - print this help then exit") } func main() { @@ -72,16 +73,19 @@ func main() { indexFs := flag.NewFlagSet("index flags", flag.ExitOnError) queryFs := flag.NewFlagSet("query flags", flag.ExitOnError) shellFs := flag.NewFlagSet("debug shell flags", flag.ExitOnError) + serverFs := flag.NewFlagSet("server flags", flag.ExitOnError) indexFs.Usage = addGlobalFlagUsage(indexFs) queryFs.Usage = addGlobalFlagUsage(queryFs) shellFs.Usage = addGlobalFlagUsage(shellFs) + serverFs.Usage = addGlobalFlagUsage(serverFs) flag.Parse() args := flag.Args() queryFlags := QueryFlags{Outputer: query.DefaultOutput{}} indexFlags := IndexFlags{} + serverFlags := ServerFlags{Port: 8080} if len(args) < 1 { fmt.Fprintln(os.Stderr, "No Command provided") @@ -94,9 +98,11 @@ func main() { switch command { case "query", "q": - setupQueryFlags(args, queryFs, &queryFlags) + setupQueryFlags(args[1:], queryFs, &queryFlags) case "index": - setupIndexFlags(args, indexFs, &indexFlags) + setupIndexFlags(args[1:], indexFs, &indexFlags) + case "server": + setupServerFlags(args[1:], serverFs, &serverFlags) case "help": printHelp() flag.PrintDefaults() @@ -151,6 +157,8 @@ func main() { exitCode = int(runQuery(globalFlags, queryFlags, querier, searchQuery)) case "index": exitCode = int(runIndex(globalFlags, indexFlags, querier)) + case "server": + exitCode = int(runServer(globalFlags, serverFlags, querier)) case "shell": state := make(shell.State) env := make(map[string]string) |
