Files
stats-gateway/psp-stats-cli/main.go
T

46 lines
792 B
Go

package main
import (
"fmt"
"os"
"github.com/bergabruh/psp-stats-cli/cmd"
)
func main() {
if len(os.Args) < 2 {
usage()
os.Exit(2)
}
switch os.Args[1] {
case "recent":
cmd.Recent(os.Args[2:])
case "aggregate":
cmd.Aggregate(os.Args[2:])
case "-h", "--help", "help":
usage()
case "version":
fmt.Println("psp-stats-cli 0.1.0")
default:
fmt.Fprintf(os.Stderr, "unknown command: %s\n\n", os.Args[1])
usage()
os.Exit(2)
}
}
func usage() {
fmt.Print(`psp-stats-cli — query PSP Speedtest Stats
Usage:
psp-stats-cli <command> [flags]
Commands:
recent Show last N probe samples
aggregate Show histogram for time range
version Show CLI version
help Show this help
Run 'psp-stats-cli <command> --help' for command-specific flags.
`)
}