1
mod command;
2
mod include;
3
mod precondition;
4
mod task;
5
mod task_context;
6
mod task_dependency;
7
mod task_root;
8
mod use_cargo;
9
mod use_npm;
10

            
11
use std::collections::HashSet;
12
use std::process::Stdio;
13
use std::sync::{
14
  Arc,
15
  Mutex,
16
};
17

            
18
pub type ExecutionStack = Arc<Mutex<HashSet<String>>>;
19

            
20
pub use command::*;
21
pub use include::*;
22
pub use precondition::*;
23
pub use task::*;
24
pub use task_context::*;
25
pub use task_dependency::*;
26
pub use task_root::*;
27
pub use use_cargo::*;
28
pub use use_npm::*;
29

            
30
pub fn is_shell_command(value: &str) -> anyhow::Result<bool> {
31
  use regex::Regex;
32

            
33
  let re = Regex::new(r"^\$\(.+\)$")?;
34
  Ok(re.is_match(value))
35
}
36

            
37
pub fn is_template_command(value: &str) -> anyhow::Result<bool> {
38
  use regex::Regex;
39

            
40
  let re = Regex::new(r"^\$\{\{.+\}\}$")?;
41
  Ok(re.is_match(value))
42
}
43

            
44
452
pub fn get_output_handler(verbose: bool) -> Stdio {
45
452
  if verbose {
46
372
    Stdio::piped()
47
  } else {
48
80
    Stdio::null()
49
  }
50
452
}