diff options
Diffstat (limited to 'src/tree')
-rw-r--r-- | src/tree/tree_line.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/tree/tree_line.rs b/src/tree/tree_line.rs index 95d571e..ef186bc 100644 --- a/src/tree/tree_line.rs +++ b/src/tree/tree_line.rs @@ -69,6 +69,12 @@ impl TreeLine { SelectionType::Directory => self.is_dir(), } } + pub fn extension(&self) -> Option<&str> { + regex!(r"\.([^.]+)$") + .captures(&self.name) + .and_then(|c| c.get(1)) + .map(|e| e.as_str()) + } pub fn selection_type(&self) -> SelectionType { use TreeLineType::*; match &self.line_type { |