You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
866 B
42 lines
866 B
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"strings"
|
|
// elastic "github.com/olivere/elastic/v7"
|
|
// toml "github.com/pelletier/go-toml"
|
|
)
|
|
|
|
func main() {
|
|
if len(os.Args) < 2 {
|
|
fmt.Fprintf(os.Stderr, "%s: required argument missing\n", os.Args[0])
|
|
printDefaultUsage()
|
|
os.Exit(1)
|
|
}
|
|
|
|
cmd := strings.ToLower(os.Args[1])
|
|
switch cmd {
|
|
case "index":
|
|
handleIndexCommand()
|
|
|
|
case "--help":
|
|
printDefaultUsage()
|
|
os.Exit(0)
|
|
|
|
default:
|
|
fmt.Fprintf(os.Stderr, "%s: '%s' is not a recognized command\n",
|
|
os.Args[0], os.Args[1])
|
|
printDefaultUsage()
|
|
os.Exit(1)
|
|
}
|
|
os.Exit(0)
|
|
}
|
|
|
|
func printDefaultUsage() {
|
|
fmt.Printf("Usage: %s <command> ...\n", os.Args[0])
|
|
fmt.Printf("See '%s <command> --help' for information", os.Args[0])
|
|
fmt.Printf(" on a specific command\n")
|
|
fmt.Printf("valid commands:\n")
|
|
fmt.Printf(" index create, delete, or list indexes\n")
|
|
}
|