Skip to content

Commit f6ae757

Browse files
allow whitespace inside {} for choose time arguments
2 parents f2e3ae4 + ebfd724 commit f6ae757

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/defaults.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ name="rust"
33
cmd="cargo run"
44
quit_fast=false
55

6+
[[runners]]
7+
name="python"
8+
cmd="python { file }"
9+
quit_fast=false
10+
611
[[runners]]
712
name="list"
813
cmd="ls"

src/runner.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl Runner {
3939
}
4040
}
4141

42-
/// Uses this runner to execute the run command
42+
/// Uses this runner to execute the its command
4343
pub fn run(&self) {
4444
let mut c = Command::new("bash");
4545
c.arg("-c");
@@ -54,8 +54,9 @@ impl Runner {
5454
}
5555
}
5656

57+
/// process choose time arguments, and do corresponding string replacements
5758
pub fn get_args(&mut self) {
58-
let re = Regex::new(r"\{(.*?)\}").unwrap();
59+
let re = Regex::new(r"\{\s*(.*?)\s*\}").unwrap();
5960
let handlebar_matches = re.find_iter(&self.cmd);
6061

6162
let keys:Vec<_> = handlebar_matches.map(|m| m.as_str()).collect();

0 commit comments

Comments
 (0)