show relative path to match log

This commit is contained in:
Ilion Beyst 2021-12-28 16:09:41 +01:00
parent 51b52db78b
commit 6d176ac99f
3 changed files with 7 additions and 7 deletions

View file

@ -16,8 +16,8 @@ pub struct RunMatchCommand {
impl RunMatchCommand { impl RunMatchCommand {
pub async fn run(self) -> io::Result<()> { pub async fn run(self) -> io::Result<()> {
let workspace = Workspace::open_current_dir()?; let workspace = Workspace::open_current_dir()?;
let map_path = workspace.maps_dir().join(format!("{}.json", &self.map));
let map_path = workspace.map_path(&self.map);
let timestamp = chrono::Local::now().format("%Y-%m-%d-%H-%M-%S"); let timestamp = chrono::Local::now().format("%Y-%m-%d-%H-%M-%S");
let log_path = workspace.match_path(&format!("{}-{}", &self.map, &timestamp)); let log_path = workspace.match_path(&format!("{}-{}", &self.map, &timestamp));
@ -33,15 +33,14 @@ impl RunMatchCommand {
let match_config = MatchConfig { let match_config = MatchConfig {
map_name: self.map, map_name: self.map,
map_path, map_path,
log_path, log_path: log_path.clone(),
players, players,
}; };
match_runner::run_match(match_config).await; match_runner::run_match(match_config).await;
println!("match completed successfully"); println!("match completed successfully");
// TODO: don't hardcode match path. // TODO: maybe print the match result as well?
// maybe print the match result as well? println!("wrote match log to {}", log_path.to_str().unwrap());
println!("wrote match log to matches/{}.log", timestamp);
Ok(()) Ok(())
} }
} }

View file

@ -29,6 +29,7 @@ impl WorkspaceBot {
pub struct BotConfig { pub struct BotConfig {
pub name: String, pub name: String,
pub run_command: String, pub run_command: String,
pub build_command: Option<String>,
} }
impl BotConfig { impl BotConfig {

View file

@ -12,8 +12,8 @@ const WORKSPACE_CONFIG_FILENAME: &str = "pw_workspace.toml";
pub mod bot; pub mod bot;
pub struct Workspace { pub struct Workspace {
root_path: PathBuf, pub root_path: PathBuf,
config: WorkspaceConfig, pub config: WorkspaceConfig,
} }
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]