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.
32 lines
535 B
32 lines
535 B
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"git.aiterp.net/lucifer/new-server/app/client"
|
|
"log"
|
|
"os"
|
|
)
|
|
|
|
func handlerCmd(
|
|
ctx context.Context,
|
|
c client.Client,
|
|
) {
|
|
cmd := parseCommand(os.Args[2:])
|
|
|
|
switch cmd.Name {
|
|
case "list":
|
|
handlers, err := c.GetHandlers(ctx, cmd.Params.Get(0).StringOr("all"))
|
|
if err != nil {
|
|
log.Fatalln(err)
|
|
}
|
|
|
|
WriteHandlerInfoTable(os.Stdout, handlers)
|
|
default:
|
|
if cmd.Name != "help" {
|
|
log.Println("Unknown command:", cmd.Name)
|
|
}
|
|
|
|
_, _ = fmt.Fprintln(os.Stderr, helpString[1:])
|
|
}
|
|
}
|