sdoc/commands/
shell.rs

1use workflow::Work;
2use workflow::Instruction::SystemCommand;
3use std::path::PathBuf;
4
5pub fn execute_shell(shell: &String, args: &[String], directory: &PathBuf) -> Work {
6    let command = format!("PATH=\"$PATH:{}\" {} {}", directory.display(), shell, quote_args(args));
7    Work::instruction(SystemCommand(command, true))
8}
9
10fn quote_args(args: &[String]) -> String {
11    let out_args : Vec<String> = args
12        .iter()
13        .map(|a| format!("'{}'", a))
14        .collect();
15
16    out_args.join(" ")
17}