feat(docs): finish part 1

Signed-off-by: Alex Chi <iskyzh@gmail.com>
This commit is contained in:
Alex Chi
2022-12-23 23:45:09 -05:00
parent 9f3e29c781
commit a03cb765ff
7 changed files with 146 additions and 4 deletions

View File

@@ -5,6 +5,11 @@ use clap::Parser;
use console::style;
use duct::cmd;
#[derive(clap::Subcommand, Debug)]
enum CopyTestAction {
Day1,
}
#[derive(clap::Subcommand, Debug)]
enum Action {
/// Check.
@@ -21,6 +26,9 @@ enum Action {
Sync,
/// Check starter code
Scheck,
/// Copy test cases
#[command(subcommand)]
CopyTest(CopyTestAction),
}
/// Simple program to greet a person
@@ -114,6 +122,20 @@ fn sync() -> Result<()> {
Ok(())
}
fn copy_test_case(test: CopyTestAction) -> Result<()> {
match test {
CopyTestAction::Day1 => {
cmd!(
"cp",
"mini-lsm/src/block/tests.rs",
"mini-lsm-starter/src/block/tests.rs"
)
.run()?;
}
}
Ok(())
}
fn main() -> Result<()> {
let args = Args::parse();
@@ -160,6 +182,10 @@ fn main() -> Result<()> {
switch_to_workspace_root()?;
sync()?;
}
Action::CopyTest(test) => {
switch_to_workspace_root()?;
copy_test_case(test)?;
}
}
Ok(())