package main import ( "flag" "fmt" "os" ) // main is the entry point for the user check CLI tool. // // The tool provides commands to query connected users and server status // by reading from the Erupe database. It's designed to be used while // the server is running to monitor player activity. // // Usage: // // usercheck [options] // usercheck list # List all connected users // usercheck count # Count connected users // usercheck search -name "player" # Search for a specific player // usercheck servers # Show server/channel status // usercheck history -name "player" # Show player login history func main() { flag.Usage = func() { fmt.Fprintf(os.Stderr, "Erupe User Check - Tool to query connected users and server status\n\n") fmt.Fprintf(os.Stderr, "Usage:\n") fmt.Fprintf(os.Stderr, " %s [options]\n\n", os.Args[0]) fmt.Fprintf(os.Stderr, "Available commands:\n") fmt.Fprintf(os.Stderr, " list List all currently connected users\n") fmt.Fprintf(os.Stderr, " count Show count of connected users per server\n") fmt.Fprintf(os.Stderr, " search Search for a specific connected user by name\n") fmt.Fprintf(os.Stderr, " servers Show server/channel status and player counts\n") fmt.Fprintf(os.Stderr, " history Show recent login history for a player\n") fmt.Fprintf(os.Stderr, "\nDatabase connection options (apply to all commands):\n") fmt.Fprintf(os.Stderr, " -host Database host (default: localhost)\n") fmt.Fprintf(os.Stderr, " -port Database port (default: 5432)\n") fmt.Fprintf(os.Stderr, " -user Database user (default: postgres)\n") fmt.Fprintf(os.Stderr, " -password Database password (required)\n") fmt.Fprintf(os.Stderr, " -dbname Database name (default: erupe)\n") fmt.Fprintf(os.Stderr, "\nUse '%s -h' for more information about a command.\n", os.Args[0]) } if len(os.Args) < 2 { flag.Usage() os.Exit(1) } command := os.Args[1] args := os.Args[2:] switch command { case "list": runList(args) case "count": runCount(args) case "search": runSearch(args) case "servers": runServers(args) case "history": runHistory(args) case "-h", "--help", "help": flag.Usage() default: fmt.Fprintf(os.Stderr, "Unknown command: %s\n\n", command) flag.Usage() os.Exit(1) } }