aboutsummaryrefslogtreecommitdiff
path: root/planetwars-cli/src/commands/run_match.rs
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-07-21 19:19:40 +0200
committerIlion Beyst <ilion.beyst@gmail.com>2022-07-21 19:19:40 +0200
commitc6293d8e328bb96c368921fe922092d4f27f0bc9 (patch)
tree1c374345ba911b79167ae70a654dd0618efa9446 /planetwars-cli/src/commands/run_match.rs
parent31f8271db6735a1c7abea4d93bb3b8d7a3ce4628 (diff)
downloadplanetwars.dev-c6293d8e328bb96c368921fe922092d4f27f0bc9.tar.xz
planetwars.dev-c6293d8e328bb96c368921fe922092d4f27f0bc9.zip
delete old planetwars-cli code
Diffstat (limited to 'planetwars-cli/src/commands/run_match.rs')
-rw-r--r--planetwars-cli/src/commands/run_match.rs51
1 files changed, 0 insertions, 51 deletions
diff --git a/planetwars-cli/src/commands/run_match.rs b/planetwars-cli/src/commands/run_match.rs
deleted file mode 100644
index 03868ae..0000000
--- a/planetwars-cli/src/commands/run_match.rs
+++ /dev/null
@@ -1,51 +0,0 @@
-use std::io;
-
-use clap::Parser;
-use planetwars_matchrunner::{run_match, MatchConfig, MatchPlayer};
-
-use crate::workspace::Workspace;
-#[derive(Parser)]
-pub struct RunMatchCommand {
- /// map name
- map: String,
- /// bot names
- bots: Vec<String>,
-}
-
-impl RunMatchCommand {
- pub async fn run(self) -> io::Result<()> {
- let workspace = Workspace::open_current_dir()?;
-
- let map_path = workspace.map_path(&self.map);
- let timestamp = chrono::Local::now().format("%Y-%m-%d-%H-%M-%S");
- let log_path = workspace.match_path(&format!("{}-{}", &self.map, &timestamp));
-
- let mut players = Vec::new();
- for bot_name in &self.bots {
- let bot = workspace.get_bot(&bot_name)?;
- players.push(MatchPlayer {
- name: bot_name.clone(),
- path: bot.path.clone(),
- argv: bot.config.get_run_argv(),
- });
- }
-
- let match_config = MatchConfig {
- map_name: self.map,
- map_path,
- log_path: log_path.clone(),
- players,
- };
-
- run_match(match_config).await;
- println!("match completed successfully");
- // TODO: maybe print the match result as well?
-
- let relative_path = match log_path.strip_prefix(&workspace.root_path) {
- Ok(path) => path.to_str().unwrap(),
- Err(_) => log_path.to_str().unwrap(),
- };
- println!("wrote match log to {}", relative_path);
- Ok(())
- }
-}