diff options
author | Ilion Beyst <ilion.beyst@gmail.com> | 2022-07-21 19:19:40 +0200 |
---|---|---|
committer | Ilion Beyst <ilion.beyst@gmail.com> | 2022-07-21 19:19:40 +0200 |
commit | c6293d8e328bb96c368921fe922092d4f27f0bc9 (patch) | |
tree | 1c374345ba911b79167ae70a654dd0618efa9446 /planetwars-cli/src/commands/init.rs | |
parent | 31f8271db6735a1c7abea4d93bb3b8d7a3ce4628 (diff) | |
download | planetwars.dev-c6293d8e328bb96c368921fe922092d4f27f0bc9.tar.xz planetwars.dev-c6293d8e328bb96c368921fe922092d4f27f0bc9.zip |
delete old planetwars-cli code
Diffstat (limited to 'planetwars-cli/src/commands/init.rs')
-rw-r--r-- | planetwars-cli/src/commands/init.rs | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/planetwars-cli/src/commands/init.rs b/planetwars-cli/src/commands/init.rs deleted file mode 100644 index c95626b..0000000 --- a/planetwars-cli/src/commands/init.rs +++ /dev/null @@ -1,38 +0,0 @@ -use std::path::PathBuf; - -use clap::Parser; -use futures::io; - -#[derive(Parser)] -pub struct InitCommand { - /// workspace root directory - path: String, -} - -macro_rules! copy_asset { - ($path:expr, $file_name:literal) => { - ::std::fs::write( - $path.join($file_name), - include_bytes!(concat!("../../assets/", $file_name)), - )?; - }; -} - -impl InitCommand { - pub async fn run(self) -> io::Result<()> { - let path = PathBuf::from(&self.path); - - // create directories - std::fs::create_dir_all(&path)?; - std::fs::create_dir(path.join("maps"))?; - std::fs::create_dir(path.join("matches"))?; - std::fs::create_dir_all(path.join("bots/simplebot"))?; - - // create files - copy_asset!(path, "pw_workspace.toml"); - copy_asset!(path.join("maps"), "hex.json"); - copy_asset!(path.join("bots/"), "simplebot/botconfig.toml"); - copy_asset!(path.join("bots/"), "simplebot/simplebot.py"); - Ok(()) - } -} |