add --test run flag
This commit is contained in:
parent
17e12433cb
commit
141db7795b
@ -25,7 +25,8 @@ fn main() {
|
|||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("run")
|
SubCommand::with_name("run")
|
||||||
.alias("r")
|
.alias("r")
|
||||||
.arg(Arg::with_name("file").required(true).index(1)),
|
.arg(Arg::with_name("file").required(true).index(1))
|
||||||
|
.arg(Arg::with_name("test").short("t").long("test")),
|
||||||
)
|
)
|
||||||
.get_matches();
|
.get_matches();
|
||||||
|
|
||||||
|
@ -1,10 +1,18 @@
|
|||||||
use crate::util::clean;
|
use crate::util::clean;
|
||||||
|
use crate::verify::test;
|
||||||
use console::{style, Emoji};
|
use console::{style, Emoji};
|
||||||
use indicatif::ProgressBar;
|
use indicatif::ProgressBar;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
pub fn run(matches: clap::ArgMatches) {
|
pub fn run(matches: clap::ArgMatches) {
|
||||||
if let Some(filename) = matches.value_of("file") {
|
if let Some(filename) = matches.value_of("file") {
|
||||||
|
if matches.is_present("test") {
|
||||||
|
match test(filename) {
|
||||||
|
Ok(_) => (),
|
||||||
|
Err(_) => (),
|
||||||
|
}
|
||||||
|
std::process::exit(0);
|
||||||
|
}
|
||||||
let bar = ProgressBar::new_spinner();
|
let bar = ProgressBar::new_spinner();
|
||||||
bar.set_message(format!("Compiling {}...", filename).as_str());
|
bar.set_message(format!("Compiling {}...", filename).as_str());
|
||||||
bar.enable_steady_tick(100);
|
bar.enable_steady_tick(100);
|
||||||
|
@ -78,7 +78,7 @@ fn compile_only(filename: &str) -> Result<(), ()> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test(filename: &str) -> Result<(), ()> {
|
pub fn test(filename: &str) -> Result<(), ()> {
|
||||||
let bar = ProgressBar::new_spinner();
|
let bar = ProgressBar::new_spinner();
|
||||||
bar.set_message(format!("Testing {}...", filename).as_str());
|
bar.set_message(format!("Testing {}...", filename).as_str());
|
||||||
bar.enable_steady_tick(100);
|
bar.enable_steady_tick(100);
|
||||||
|
Reference in New Issue
Block a user