1
0
Fork 0
mirror of https://codeberg.org/Mo8it/How_To_Linux.git synced 2024-11-21 19:18:02 +00:00

Add intro task

This commit is contained in:
Mo 2023-08-14 01:25:22 +02:00
parent ca5f42d273
commit fabb98c5a5
5 changed files with 42 additions and 3 deletions

4
cs/Cargo.lock generated
View file

@ -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",

View file

@ -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"

View file

@ -0,0 +1,15 @@
use collective_score_client::{
check::{Check, IntoTask, RunnableCheck},
validator::{stdin::Stdin, string_content::StringContent},
};
pub fn task() -> (&'static str, Box<dyn RunnableCheck>) {
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")
}

7
cs/src/day1/mod.rs Normal file
View file

@ -0,0 +1,7 @@
mod collective_score_intro;
use collective_score_client::check::RunnableCheck;
pub fn tasks() -> [(&'static str, Box<dyn RunnableCheck>); 1] {
[collective_score_intro::task()]
}

17
cs/src/main.rs Normal file
View file

@ -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);
}
}