diff options
author | Ilion Beyst <ilion.beyst@gmail.com> | 2021-12-26 22:00:20 +0100 |
---|---|---|
committer | Ilion Beyst <ilion.beyst@gmail.com> | 2021-12-26 22:00:20 +0100 |
commit | 31b439ee313c9268ac338dd130390d4f7200e693 (patch) | |
tree | 75b3905deacdd849d5fb4fab7e28ed3bf366151b /planetwars-cli/src/commands | |
parent | 0d03a0fbc214dd3fb9a8af562f9d88cccaf5f2c0 (diff) | |
download | planetwars.dev-31b439ee313c9268ac338dd130390d4f7200e693.tar.xz planetwars.dev-31b439ee313c9268ac338dd130390d4f7200e693.zip |
rebrand project to workspace
Diffstat (limited to 'planetwars-cli/src/commands')
-rw-r--r-- | planetwars-cli/src/commands/init.rs | 4 | ||||
-rw-r--r-- | planetwars-cli/src/commands/mod.rs | 2 | ||||
-rw-r--r-- | planetwars-cli/src/commands/run_match.rs | 18 | ||||
-rw-r--r-- | planetwars-cli/src/commands/serve.rs | 4 |
4 files changed, 14 insertions, 14 deletions
diff --git a/planetwars-cli/src/commands/init.rs b/planetwars-cli/src/commands/init.rs index 42491bc..3c9cf08 100644 --- a/planetwars-cli/src/commands/init.rs +++ b/planetwars-cli/src/commands/init.rs @@ -5,7 +5,7 @@ use futures::io; #[derive(Parser)] pub struct InitCommand { - /// project root directory + /// workspace root directory path: String, } @@ -29,7 +29,7 @@ impl InitCommand { std::fs::create_dir_all(path.join("bots/simplebot"))?; // create files - copy_asset!(path, "pw_project.toml"); + copy_asset!(path, "pw_workspace.toml"); copy_asset!(path.join("maps"), "hex.json"); copy_asset!(path.join("bots/simplebot"), "simplebot.py"); diff --git a/planetwars-cli/src/commands/mod.rs b/planetwars-cli/src/commands/mod.rs index 6606c77..db0be21 100644 --- a/planetwars-cli/src/commands/mod.rs +++ b/planetwars-cli/src/commands/mod.rs @@ -27,7 +27,7 @@ impl Cli { #[derive(Subcommand)] enum Command { - /// Initialize a new project + /// Initialize a new workspace Init(init::InitCommand), /// Run a match RunMatch(run_match::RunMatchCommand), diff --git a/planetwars-cli/src/commands/run_match.rs b/planetwars-cli/src/commands/run_match.rs index a5512f4..039d89a 100644 --- a/planetwars-cli/src/commands/run_match.rs +++ b/planetwars-cli/src/commands/run_match.rs @@ -7,7 +7,7 @@ use crate::match_runner; use crate::match_runner::MatchBot; use crate::match_runner::MatchConfig; use crate::resolve_bot_config; -use crate::ProjectConfig; +use crate::WorkspaceConfig; #[derive(Parser)] pub struct RunMatchCommand { @@ -19,24 +19,24 @@ pub struct RunMatchCommand { impl RunMatchCommand { pub async fn run(self) -> io::Result<()> { - let project_dir = env::current_dir().unwrap(); + let workspace_root = env::current_dir().unwrap(); - let config_path = project_dir.join("pw_project.toml"); + let config_path = workspace_root.join("pw_workspace.toml"); - let map_path = project_dir.join(format!("maps/{}.json", self.map)); + let map_path = workspace_root.join(format!("maps/{}.json", self.map)); let timestamp = chrono::Local::now().format("%Y-%m-%d-%H-%M-%S"); - let log_path = project_dir.join(format!("matches/{}.log", timestamp)); + let log_path = workspace_root.join(format!("matches/{}.log", timestamp)); let config_str = std::fs::read_to_string(config_path).unwrap(); - let project_config: ProjectConfig = toml::from_str(&config_str).unwrap(); + let workspace_config: WorkspaceConfig = toml::from_str(&config_str).unwrap(); let players = self .bots .into_iter() .map(|bot_name| { - let bot_config = project_config.bots.get(&bot_name).unwrap().clone(); - let resolved_config = resolve_bot_config(&project_dir, bot_config); + let bot_config = workspace_config.bots.get(&bot_name).unwrap().clone(); + let resolved_config = resolve_bot_config(&workspace_root, bot_config); MatchBot { name: bot_name, bot_config: resolved_config, @@ -54,7 +54,7 @@ impl RunMatchCommand { match_runner::run_match(match_config).await; println!("match completed successfully"); // TODO: don't hardcode match path. - // maybe print the match result as well? + // maybe print the match result as well? println!("wrote match log to matches/{}.log", timestamp); Ok(()) } diff --git a/planetwars-cli/src/commands/serve.rs b/planetwars-cli/src/commands/serve.rs index 2a2e59b..a078c83 100644 --- a/planetwars-cli/src/commands/serve.rs +++ b/planetwars-cli/src/commands/serve.rs @@ -10,9 +10,9 @@ pub struct ServeCommand; impl ServeCommand { pub async fn run(self) -> io::Result<()> { - let project_dir = env::current_dir().unwrap(); + let workspace_root = env::current_dir().unwrap(); - web::run(project_dir).await; + web::run(workspace_root).await; Ok(()) } } |