summaryrefslogtreecommitdiffstats
path: root/src/verb/exec_pattern.rs
diff options
context:
space:
mode:
authorCanop <cano.petrole@gmail.com>2021-04-08 17:22:30 +0200
committerCanop <cano.petrole@gmail.com>2021-04-15 13:00:23 +0200
commit831c10d6c5ccf74d0109b6bc3ffd708a9da61cab (patch)
tree1435f23e6f19549e49f01e52f4cbfc702ec3a06b /src/verb/exec_pattern.rs
parentacade5051d04d14509b5526f48b1bb9de2ee4f70 (diff)
staging area [WIP]
The staging area will be the way to operate on multiple files. See issue #266 (it's far from ready)
Diffstat (limited to 'src/verb/exec_pattern.rs')
-rw-r--r--src/verb/exec_pattern.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/verb/exec_pattern.rs b/src/verb/exec_pattern.rs
index 1a59831..322f262 100644
--- a/src/verb/exec_pattern.rs
+++ b/src/verb/exec_pattern.rs
@@ -23,6 +23,12 @@ impl ExecPattern {
Self::Array(v) => v.is_empty(),
}
}
+ pub fn has_selection_group(&self) -> bool {
+ match self {
+ Self::String(s) => str_has_selection_group(s),
+ Self::Array(v) => v.iter().any(|s| str_has_selection_group(s)),
+ }
+ }
pub fn has_other_panel_group(&self) -> bool {
match self {
Self::String(s) => str_has_other_panel_group(s),
@@ -95,6 +101,17 @@ impl ExecPattern {
}
}
+fn str_has_selection_group(s: &str) -> bool {
+ for group in GROUP.find_iter(s) {
+ if matches!(
+ group.as_str(),
+ "{file}" | "{parent}" | "{directory}"
+ ){
+ return true;
+ }
+ }
+ false
+}
fn str_has_other_panel_group(s: &str) -> bool {
for group in GROUP.find_iter(s) {
if group.as_str().starts_with("{other-panel-") {