From bac32045724f6e9dedd7383fa627d3eeaa35e3b1 Mon Sep 17 00:00:00 2001 From: ari melody Date: Mon, 14 Apr 2025 23:53:03 +0100 Subject: [PATCH] improve runtime docs --- Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 4 ++-- src/main.rs | 12 ++++++++++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7a04376..7166ce7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -118,7 +118,7 @@ checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] name = "mcstatusface" -version = "1.0.0" +version = "1.0.1" dependencies = [ "chrono", "serde", diff --git a/Cargo.toml b/Cargo.toml index 70db94f..a4a24c9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ authors = ["ari melody "] repository = "https://git.arimelody.me/ari/mcstatusface" license = "MIT" keywords = ["minecraft", "server", "query", "web"] -version = "1.0.0" +version = "1.0.1" edition = "2024" [dependencies] diff --git a/README.md b/README.md index 6ab3e2f..3708042 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ convenient format! ## Usage -McStatusFace can be run as a web server with `./mcstatusface serve`. This will +McStatusFace can be run as a web server with `mcstatusface serve`. This will provide server information in JSON format to requests on `GET /?s=`. (e.g. `curl -sS "127.0.0.1:8080?s=127.0.0.1:25565" | jq .`) -Alternatively, you can simply run `./mcstatusface `, and the +Alternatively, you can simply run `mcstatusface `, and the tool will provide server details in plain-text format. diff --git a/src/main.rs b/src/main.rs index 645fec8..8548f9b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,8 +8,16 @@ use mcstatusface::{MinecraftStatus}; fn main() -> Result<()> { let args: Vec = env::args().collect(); if args.len() < 2 { - eprintln!("Usage: {} [serve] ", args[0]); - std::process::exit(1); + println!( + r#"Crafty McStatusFace, v{} - made with <3 by ari melody + + Host a web API: +$ mcstatusface serve [address[:port]] + + Query a server: +$ mcstatusface "#, +env!("CARGO_PKG_VERSION")); + std::process::exit(0); } if args[1] != "serve" {