Added runner stubs for running variations

pull/2/head
Ayrton Chilibeck 2024-01-12 12:35:24 -07:00
parent 4ed6600ebc
commit 735736807d
Signed by: ayrton
GPG Key ID: BAE24A03DCBF160D
4 changed files with 29 additions and 6 deletions

5
src/grade.rs Normal file
View File

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

View File

@ -2,14 +2,22 @@ use std::path::PathBuf;
use clap::{Parser, Subcommand};
mod validate;
mod run;
mod grade;
fn main() {
// get cli args
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);
println!("Hello, world!");
match &cli.command {
Command::Validate => validate::validate(verbosity, cli.config_file),
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
@ -44,10 +52,10 @@ enum Command {
Grade,
}
fn get_verbosity(cli: Cli) -> u8 {
fn get_verbosity(verb: Option<u8>) -> u8 {
// Check the user defined verbosity, if none, set to normal
let verbosity: u8;
match cli.verbosity {
match verb {
Some(x) => verbosity = x,
None => verbosity = 1,
}

5
src/run.rs Normal file
View File

@ -0,0 +1,5 @@
use std::path::PathBuf;
pub fn run(verbosity: u8, config_file: PathBuf) {
println!("Running!");
}

5
src/validate.rs Normal file
View File

@ -0,0 +1,5 @@
use std::path::PathBuf;
pub fn validate(verbosity: u8, config_file: PathBuf) {
println!("Validating");
}