Added runner stubs for running variations
parent
4ed6600ebc
commit
735736807d
|
@ -0,0 +1,5 @@
|
||||||
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
|
pub fn grade(verbosity: u8, config_file: PathBuf, grade_config: Option<&Path>) {
|
||||||
|
println!("Grading!");
|
||||||
|
}
|
20
src/main.rs
20
src/main.rs
|
@ -2,14 +2,22 @@ use std::path::PathBuf;
|
||||||
|
|
||||||
use clap::{Parser, Subcommand};
|
use clap::{Parser, Subcommand};
|
||||||
|
|
||||||
|
mod validate;
|
||||||
|
mod run;
|
||||||
|
mod grade;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
// get cli args
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
|
|
||||||
let verbosity = get_verbosity(cli);
|
// parse the verbosity and eliminate the Option<>
|
||||||
|
let verbosity = get_verbosity(cli.verbosity);
|
||||||
|
|
||||||
println!("verbosity = {}", verbosity);
|
match &cli.command {
|
||||||
|
Command::Validate => validate::validate(verbosity, cli.config_file),
|
||||||
println!("Hello, world!");
|
Command::Run => run::run(verbosity, cli.config_file),
|
||||||
|
Command::Grade => grade::grade(verbosity, cli.config_file, cli.grading_conf.as_deref()),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize CLI arguments using clap
|
// Initialize CLI arguments using clap
|
||||||
|
@ -44,10 +52,10 @@ enum Command {
|
||||||
Grade,
|
Grade,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_verbosity(cli: Cli) -> u8 {
|
fn get_verbosity(verb: Option<u8>) -> u8 {
|
||||||
// Check the user defined verbosity, if none, set to normal
|
// Check the user defined verbosity, if none, set to normal
|
||||||
let verbosity: u8;
|
let verbosity: u8;
|
||||||
match cli.verbosity {
|
match verb {
|
||||||
Some(x) => verbosity = x,
|
Some(x) => verbosity = x,
|
||||||
None => verbosity = 1,
|
None => verbosity = 1,
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
pub fn run(verbosity: u8, config_file: PathBuf) {
|
||||||
|
println!("Running!");
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
pub fn validate(verbosity: u8, config_file: PathBuf) {
|
||||||
|
println!("Validating");
|
||||||
|
}
|
Loading…
Reference in New Issue