Merge branch 'master' of github.com:/MajorBarnulf/epitls-pi
This commit is contained in:
commit
37cad03cf3
6 changed files with 84 additions and 21 deletions
39
src/main.rs
39
src/main.rs
|
@ -1,3 +1,5 @@
|
|||
use std::env;
|
||||
|
||||
use clap::{Parser, Subcommand};
|
||||
use config::Config;
|
||||
|
||||
|
@ -45,10 +47,9 @@ pub enum Commands {
|
|||
|
||||
/// Files to run tests from.
|
||||
files: Vec<String>,
|
||||
|
||||
/// Specific tests to run.
|
||||
#[clap(short, long)]
|
||||
tests: Vec<String>,
|
||||
// /// Specific tests to run.
|
||||
// #[clap(short, long)]
|
||||
// tests: Vec<String>,
|
||||
},
|
||||
|
||||
/// Watches changes to the project included files and runs a command on changes.
|
||||
|
@ -61,11 +62,13 @@ pub enum Commands {
|
|||
|
||||
/// Initializes a project directory configuration, useful for custom flags, includes and custop push messages.
|
||||
init {
|
||||
/// Path to the folder containing the project.
|
||||
path: String,
|
||||
|
||||
/// Identifier for the automated tests.
|
||||
identifier: String,
|
||||
prefix: String,
|
||||
/// Path to the folder containing the project.
|
||||
path: Option<String>,
|
||||
/// e
|
||||
#[clap(short, long)]
|
||||
tests: bool,
|
||||
},
|
||||
|
||||
/// Pushes changes to the git server with a custom tag.
|
||||
|
@ -87,6 +90,7 @@ fn compilation_args() -> Vec<String> {
|
|||
"-fsanitize=address".to_string(),
|
||||
"-Wextra".to_string(),
|
||||
"-std=c99".to_string(),
|
||||
// "-pedantic".to_string(),
|
||||
];
|
||||
if Config::get_local_or_default().strict_mode() {
|
||||
args.push("-Werror".to_string());
|
||||
|
@ -114,15 +118,14 @@ fn main() {
|
|||
Commands::test {
|
||||
capture,
|
||||
mut files,
|
||||
tests,
|
||||
// tests,
|
||||
} => {
|
||||
if files.is_empty() {
|
||||
files.push(Config::get_local_or_default().test_file().to_string());
|
||||
}
|
||||
append_includes(&mut files);
|
||||
let args = compilation_args();
|
||||
let tests = (!tests.is_empty()).then_some(tests);
|
||||
test::main(capture, files, args, tests)
|
||||
test::main(capture, files, args)
|
||||
}
|
||||
Commands::watch { command, files } => {
|
||||
let mut files = files.unwrap_or_default();
|
||||
|
@ -130,8 +133,18 @@ fn main() {
|
|||
watch::main(files, command);
|
||||
}
|
||||
|
||||
Commands::init { path, identifier } => {
|
||||
config::create(path, identifier);
|
||||
Commands::init {
|
||||
path,
|
||||
prefix,
|
||||
tests,
|
||||
} => {
|
||||
let path =
|
||||
path.unwrap_or_else(|| env::current_dir().unwrap().to_str().unwrap().to_string());
|
||||
let prefix = prefix.trim().trim_end_matches('*');
|
||||
config::create(path.clone(), prefix.to_string());
|
||||
if tests {
|
||||
config::create_test(path);
|
||||
}
|
||||
}
|
||||
|
||||
Commands::push { message } => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue