From 4df50b07df35f8c75980ce19d954f3f366dae848 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Wed, 4 Sep 2024 21:20:26 +0200 Subject: mapinfo command --- server/src/commands.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'server/src/commands.rs') diff --git a/server/src/commands.rs b/server/src/commands.rs index 5354c266..c33f5832 100644 --- a/server/src/commands.rs +++ b/server/src/commands.rs @@ -40,6 +40,11 @@ enum Command { /// Name of the map, default: current map: Option, }, + #[clap(alias = "mapinfo")] + Info { + /// Name of the map, default: current + map: Option, + }, /// Abort the current game End, /// Download recipe/map's source declaration @@ -184,6 +189,20 @@ impl Server { bail!("{o}"); } } + Command::Info { map } => { + let mapname = map.as_ref().unwrap_or(&self.game.data.current_map); + let info = self + .index + .maps + .get(mapname) + .ok_or(anyhow!("no information available"))?; + bail!( + "{:?}\nRecommended player count: {}\nDifficulty: {}", + info.name, + info.difficulty, + info.players + ) + } } Ok(()) } -- cgit v1.2.3-70-g09d2