mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-05-06 07:17:27 +00:00
refactor(cli): improve how we serve the bin to users
This commit is contained in:
parent
8fab167157
commit
3bcf9385f2
6 changed files with 52 additions and 18 deletions
|
|
@ -13,3 +13,10 @@ codegen-units = 1
|
|||
|
||||
[profile.release.package."*"]
|
||||
opt-level = 3
|
||||
|
||||
# When building locally, use the local version of the library
|
||||
# Comment this out when you want to resolve the library from crates.io
|
||||
# This is only for crates that use gamedig as a dependency
|
||||
# https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html
|
||||
[patch.crates-io]
|
||||
gamedig = { path = "./crates/lib" }
|
||||
|
|
@ -101,7 +101,8 @@ Want to see more examples? Checkout the [examples](crates/lib/examples) folder.
|
|||
|
||||
## Command Line Interface
|
||||
|
||||
The library also has an official CLI: [GameDig-CLI](https://crates.io/crates/gamedig-cli).
|
||||
The library also has an [official CLI](https://crates.io/crates/gamedig_cli) that you can use but it has
|
||||
MSRV of `1.74.1`.
|
||||
|
||||
## Documentation
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "gamedig-cli"
|
||||
name = "gamedig_cli"
|
||||
authors = [
|
||||
"rust-GameDig contributors [https://github.com/gamedig/rust-gamedig/contributors]",
|
||||
]
|
||||
|
|
@ -7,14 +7,13 @@ description = "A command line interface for gamedig"
|
|||
license = "MIT"
|
||||
version = "0.1.1"
|
||||
edition = "2021"
|
||||
default-run = "gamedig-cli"
|
||||
default-run = "gamedig_cli"
|
||||
homepage = "https://gamedig.github.io/"
|
||||
documentation = "https://docs.rs/gamedig-cli/latest/gamedig-cli/"
|
||||
repository = "https://github.com/gamedig/rust-gamedig"
|
||||
readme = "README.md"
|
||||
keywords = ["server", "query", "game", "check", "status"]
|
||||
rust-version = "1.65.0"
|
||||
categories = ["parsing", "command-line-interface"]
|
||||
rust-version = "1.74.1"
|
||||
categories = ["command-line-interface"]
|
||||
|
||||
[features]
|
||||
default = ["json", "bson", "xml", "browser"]
|
||||
|
|
@ -34,7 +33,7 @@ browser = ["dep:webbrowser"]
|
|||
# Core Dependencies
|
||||
thiserror = "2.0.0"
|
||||
clap = { version = "4.5.4", default-features = false, features = ["derive"] }
|
||||
gamedig = { version = "*", path = "../lib", default-features = false, features = [
|
||||
gamedig = { version = "0.5", default-features = false, features = [
|
||||
"clap",
|
||||
"games",
|
||||
"game_defs",
|
||||
|
|
|
|||
21
crates/cli/LICENSE.md
Normal file
21
crates/cli/LICENSE.md
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2022 - 2024 GameDig Organization & Contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
|
@ -1,20 +1,26 @@
|
|||
# rust-GameDig CLI
|
||||
|
||||
The official [rust-GameDig](https://crates.io/crates/gamedig) Command Line Interface.
|
||||
The official [rust-GameDig](https://crates.io/crates/gamedig_cli) Command Line Interface.
|
||||
|
||||
[](https://github.com/gamedig/rust-gamedig/actions) [](https://github.com/gamedig/rust-gamedig/blob/main/LICENSE.md) [](https://github.com/gamedig/node-gamedig)
|
||||
|
||||
## Community
|
||||
## Installation
|
||||
|
||||
Checkout the GameDig Community Discord Server [here](https://discord.gg/NVCMn3tnxH).
|
||||
Note that it isn't be a replacement for GitHub issues, if you have found a problem
|
||||
within the library or want to request a feature, it's better to do so here rather than
|
||||
on Discord.
|
||||
You can install the CLI via `cargo`:
|
||||
|
||||
```sh
|
||||
cargo install gamedig_cli
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```sh
|
||||
cargo install gamedig_cli --git https://github.com/gamedig/rust-gamedig.git
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Just by running `gamedig-cli` prints the usage.
|
||||
**Note**: Passing `--help` (or `-h`) shows the usage.
|
||||
Running `gamedig_cli` without any arguments will display the usage information. You can also use the `--help` (or `-h`) flag to see detailed usage instructions.
|
||||
|
||||
Here's also a quick rundown of a simple query with the `json-pretty` format:
|
||||
|
||||
|
|
@ -26,8 +32,8 @@ can also be optional if the server is running the default ports) then query on i
|
|||
|
||||
[Team Fortress 2](https://store.steampowered.com/app/440/Team_Fortress_2/) query example:
|
||||
|
||||
```
|
||||
gamedig-cli query -g teamfortress2 -i 127.0.0.1 -f json-pretty
|
||||
```sh
|
||||
gamedig_cli query -g teamfortress2 -i 127.0.0.1 -f json-pretty
|
||||
```
|
||||
|
||||
What we are doing here:
|
||||
|
|
|
|||
|
|
@ -479,7 +479,7 @@ fn main() -> Result<()> {
|
|||
Action::License => {
|
||||
// Bake the license into the binary
|
||||
// so we don't have to ship it separately
|
||||
println!("{}", include_str!("../../../LICENSE.md"));
|
||||
println!("{}", include_str!("../LICENSE.md"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue