diff --git a/cs/Cargo.lock b/cs/Cargo.lock index f1ad7ae..a4b5288 100644 --- a/cs/Cargo.lock +++ b/cs/Cargo.lock @@ -190,9 +190,9 @@ checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" [[package]] name = "collective-score-client" -version = "0.0.1" +version = "0.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ad4919469cf579f106ffcc9787d4b483aadd0474cdcb21afdcb9c8ba93c1ed" +checksum = "18bad7c08c5e9754d1b3a09aab531b2a5112ecb241c8bbf7d52c164db5cfab37" dependencies = [ "anyhow", "clap", diff --git a/cs/Cargo.toml b/cs/Cargo.toml index 24a6fff..33afbf4 100644 --- a/cs/Cargo.toml +++ b/cs/Cargo.toml @@ -8,4 +8,4 @@ license = "AGPL-3.0" repository = "https://codeberg.org/mo8it/dev-tools" [dependencies] -collective-score-client = "0.0.1" +collective-score-client = "0.0.2" diff --git a/cs/src/day1/collective_score_intro.rs b/cs/src/day1/collective_score_intro.rs new file mode 100644 index 0000000..48f8910 --- /dev/null +++ b/cs/src/day1/collective_score_intro.rs @@ -0,0 +1,15 @@ +use collective_score_client::{ + check::{Check, IntoTask, RunnableCheck}, + validator::{stdin::Stdin, string_content::StringContent}, +}; + +pub fn task() -> (&'static str, Box) { + Check::builder() + .description("Checking stdin") + .validator(Stdin { + expected: StringContent::Full("OK\n"), + }) + .hint("Did you pipe `echo \"OK\"` into this command?") + .build() + .into_task("collective-score-intro") +} diff --git a/cs/src/day1/mod.rs b/cs/src/day1/mod.rs new file mode 100644 index 0000000..4420809 --- /dev/null +++ b/cs/src/day1/mod.rs @@ -0,0 +1,7 @@ +mod collective_score_intro; + +use collective_score_client::check::RunnableCheck; + +pub fn tasks() -> [(&'static str, Box); 1] { + [collective_score_intro::task()] +} diff --git a/cs/src/main.rs b/cs/src/main.rs new file mode 100644 index 0000000..d42349f --- /dev/null +++ b/cs/src/main.rs @@ -0,0 +1,17 @@ +mod day1; + +use collective_score_client::run; +use std::process; + +fn main() { + let tasks = day1::tasks().into_iter().collect(); + + if let Err(e) = run( + tasks, + "collective-score-dev-tools", + "https://collective-score.mo8it.com", + ) { + eprintln!("{e:?}"); + process::exit(1); + } +}