Improve source query diagnostics
This commit is contained in:
@@ -29,6 +29,7 @@ func main() {
|
||||
}
|
||||
|
||||
client := gamestatus.NewAll(cfg.timeout)
|
||||
client.SetSourceDebug(cfg.debug)
|
||||
|
||||
info, err := connect(client, cfg.edition, host, port, cfg.useQuery)
|
||||
if err != nil {
|
||||
@@ -54,6 +55,7 @@ type cliConfig struct {
|
||||
useQuery bool
|
||||
pretty bool
|
||||
motdRaw bool
|
||||
debug bool
|
||||
}
|
||||
|
||||
func parseCLI(args []string) (cliConfig, string, error) {
|
||||
@@ -70,6 +72,7 @@ func parseCLI(args []string) (cliConfig, string, error) {
|
||||
useQuery := fs.Bool("query", false, "use full query when supported")
|
||||
pretty := fs.Bool("pretty", false, "use compact human-friendly output")
|
||||
motdRaw := fs.Bool("motd-raw", false, "print raw MOTD without cleanup")
|
||||
debug := fs.Bool("debug", false, "print protocol-specific diagnostics")
|
||||
|
||||
if len(args) > 0 {
|
||||
switch strings.ToLower(strings.TrimSpace(args[0])) {
|
||||
@@ -96,6 +99,7 @@ func parseCLI(args []string) (cliConfig, string, error) {
|
||||
cfg.useQuery = *useQuery
|
||||
cfg.pretty = *pretty
|
||||
cfg.motdRaw = *motdRaw
|
||||
cfg.debug = *debug
|
||||
|
||||
if fs.NArg() != 1 {
|
||||
return cfg, "", nil
|
||||
@@ -126,6 +130,8 @@ func printUsage() {
|
||||
fmt.Fprintln(os.Stderr, " use compact human-friendly output")
|
||||
fmt.Fprintln(os.Stderr, " -motd-raw")
|
||||
fmt.Fprintln(os.Stderr, " print raw MOTD without cleanup")
|
||||
fmt.Fprintln(os.Stderr, " -debug")
|
||||
fmt.Fprintln(os.Stderr, " print protocol-specific diagnostics")
|
||||
}
|
||||
|
||||
func connect(client *gamestatus.Client, edition, host string, port int, useQuery bool) (*gamestatus.ServerInfo, error) {
|
||||
|
||||
Reference in New Issue
Block a user