Modified runners to accept a config object
ci/woodpecker/push/workflow Pipeline was successful Details
ci/woodpecker/pr/workflow Pipeline was successful Details

pull/3/head
Ayrton Chilibeck 2024-01-12 21:54:57 -07:00
parent 6e9b15571c
commit 6449aed9ec
Signed by: ayrton
GPG Key ID: BAE24A03DCBF160D
4 changed files with 29 additions and 9 deletions

View File

@ -1,5 +1,7 @@
use std::path::{Path, PathBuf}; use std::path::Path;
pub fn grade(verbosity: u8, config_file: PathBuf, grade_config: Option<&Path>) { use crate::util;
pub fn grade(verbosity: u8, config: util::config::Config, grade_config: Option<&Path>) {
println!("Grading!"); println!("Grading!");
} }

View File

@ -5,6 +5,7 @@ use clap::{Parser, Subcommand};
mod validate; mod validate;
mod run; mod run;
mod grade; mod grade;
pub mod util;
fn main() { fn main() {
// get cli args // get cli args
@ -12,11 +13,15 @@ fn main() {
// parse the verbosity and eliminate the Option<> // parse the verbosity and eliminate the Option<>
let verbosity = get_verbosity(cli.verbosity); let verbosity = get_verbosity(cli.verbosity);
let config = util::config::parse_config(cli.config_file);
//parse the config file
// let config = parse_config(cli.config_file);
match &cli.command { match &cli.command {
Command::Validate => validate::validate(verbosity, cli.config_file), Command::Validate => validate::validate(verbosity, config),
Command::Run => run::run(verbosity, cli.config_file), Command::Run => run::run(verbosity, config),
Command::Grade => grade::grade(verbosity, cli.config_file, cli.grading_conf.as_deref()), Command::Grade => grade::grade(verbosity, config, cli.grading_conf.as_deref()),
} }
} }
@ -28,6 +33,8 @@ struct Cli {
#[arg(short, long, action = clap::ArgAction::Count)] #[arg(short, long, action = clap::ArgAction::Count)]
verbosity: Option<u8>, verbosity: Option<u8>,
//TODO implement a thread count variable for the runner
/// Set the config file /// Set the config file
#[arg(short, long, value_name = "CONFIG")] #[arg(short, long, value_name = "CONFIG")]
config_file: PathBuf, config_file: PathBuf,

View File

@ -1,5 +1,10 @@
use std::path::PathBuf; use crate::util;
pub fn run(verbosity: u8, config_file: PathBuf) { pub fn run(verbosity: u8, config: util::config::Config) {
println!("Running!"); println!("Running!");
} }
#[cfg(test)]
mod tests {
}

View File

@ -1,5 +1,11 @@
use std::path::PathBuf; use crate::util;
pub fn validate(verbosity: u8, config_file: PathBuf) { pub fn validate(verbosity: u8, config: util::config::Config) {
println!("Validating"); println!("Validating");
} }
#[cfg(test)]
mod tests {
}