gamedig / rust-gamedig

Game Server Query Library.
https://crates.io/crates/gamedig
MIT License
39 stars 12 forks source link

Various improvements for the CLI #159

Closed Douile closed 10 months ago

Douile commented 10 months ago

There was a bunch of things I wanted to add to the CLI so I put them in one PR.

If there's any that need more work or we don't want I can remove/split into other PR.

NOTE whichever of this or #158 gets merged first will cause issue with clap args.

CosminPerRam commented 10 months ago

Got #158 ahead (:

Douile commented 10 months ago

The CI failure is due to poorly written CI (by me), and should be fixed by #161. Other than that I think this is pretty much good to go.

The new --help output (with JSON feature enabled ``` A command line interface for gamedig Usage: gamedig-cli [OPTIONS] --game --ip Options: -g, --game Unique identifier of the game for which server information is being queried -i, --ip Hostname or IP address of the server -p, --port Optional query port number for the server. If not provided the default port for the game is used -j, --json Flag indicating if the output should be in JSON format -o, --output-mode Which response variant to use when outputting [default: generic] Possible values: - generic: A generalised response that maps common fields from all game types to the same name - protocol-specific: The raw result returned from the protocol query, formatted similarly to how the server returned it -h, --help Print help (see a summary with '-h') -V, --version Print version Timeouts: --connect-timeout Socket connect timeout (in seconds) [default: 4] --read-timeout Socket read timeout (in seconds) [default: 4] --write-timeout Socket write timeout (in seconds) [default: 4] --retries Number of retries per request [default: 0] Query options: --hostname The server's hostname. Used by: - [minecraft::RequestSettings#structfield.hostname] --protocol-version The protocol version to use. Used by: - [minecraft::RequestSettings#structfield.protocol_version] --gather-players Whether to gather player information Used by: - [valve::GatheringSettings#structfield.players] [possible values: true, false] --gather-rules Whether to gather rule information. Used by: - [valve::GatheringSettings#structfield.rules] [possible values: true, false] --check-app-id Whether to check if the App ID is valid. Used by: - [valve::GatheringSettings#structfield.check_app_id] [possible values: true, false] ```