1mod command;
2mod include;
3mod precondition;
4mod shell;
5mod task;
6mod task_context;
7mod task_dependency;
8mod task_root;
9mod use_cargo;
10mod use_npm;
11
12use std::collections::HashSet;
13use std::process::Stdio;
14use std::sync::{
15 Arc,
16 Mutex,
17};
18
19pub type ExecutionStack = Arc<Mutex<HashSet<String>>>;
20
21pub use command::*;
22pub use include::*;
23pub use precondition::*;
24pub use shell::*;
25pub use task::*;
26pub use task_context::*;
27pub use task_dependency::*;
28pub use task_root::*;
29pub use use_cargo::*;
30pub use use_npm::*;
31
32pub fn is_shell_command(value: &str) -> anyhow::Result<bool> {
33 use regex::Regex;
34
35 let re = Regex::new(r"^\$\(.+\)$")?;
36 Ok(re.is_match(value))
37}
38
39pub fn is_template_command(value: &str) -> anyhow::Result<bool> {
40 use regex::Regex;
41
42 let re = Regex::new(r"^\$\{\{.+\}\}$")?;
43 Ok(re.is_match(value))
44}
45
46pub fn get_output_handler(verbose: bool) -> Stdio {
47 if verbose {
48 Stdio::piped()
49 } else {
50 Stdio::null()
51 }
52}