diff --git a/src/exec/mod.rs b/src/exec/mod.rs index cff754c..15e1ae5 100644 --- a/src/exec/mod.rs +++ b/src/exec/mod.rs @@ -19,7 +19,6 @@ use self::command::execute_command; use self::input::{basename, dirname, remove_extension}; pub use self::job::{batch, job}; use self::token::Token; -use crate::filesystem::strip_current_dir; /// Execution mode of the command #[derive(Debug, Clone, Copy, PartialEq)] @@ -73,7 +72,7 @@ impl CommandTemplate { S: AsRef, { lazy_static! { - static ref PLACEHOLDER_PATTERN: Regex = Regex::new(r"\{(/?\.?|//|-|//-)\}").unwrap(); + static ref PLACEHOLDER_PATTERN: Regex = Regex::new(r"\{(/?\.?|//)\}").unwrap(); } let mut args = Vec::new(); @@ -99,8 +98,6 @@ impl CommandTemplate { "{/}" => tokens.push(Token::Basename), "{//}" => tokens.push(Token::Parent), "{/.}" => tokens.push(Token::BasenameNoExt), - "{-}" => tokens.push(Token::StripPrefix), - "{//-}" => tokens.push(Token::ParentStripPrefix), _ => unreachable!("Unhandled placeholder"), } @@ -234,14 +231,6 @@ impl ArgumentTemplate { Placeholder => { s.push(Self::replace_separator(path.as_ref(), path_separator)) } - StripPrefix => { - let path = strip_current_dir(path); - s.push(Self::replace_separator(path.as_ref(), path_separator)) - } - ParentStripPrefix => { - let path = strip_current_dir(path); - s.push(Self::replace_separator(&dirname(path), path_separator)) - } Text(ref string) => s.push(string), } } diff --git a/src/exec/token.rs b/src/exec/token.rs index 9eb68df..0cf4df3 100644 --- a/src/exec/token.rs +++ b/src/exec/token.rs @@ -11,8 +11,6 @@ pub enum Token { Parent, NoExt, BasenameNoExt, - StripPrefix, - ParentStripPrefix, Text(String), } @@ -24,8 +22,6 @@ impl Display for Token { Token::Parent => f.write_str("{//}")?, Token::NoExt => f.write_str("{.}")?, Token::BasenameNoExt => f.write_str("{/.}")?, - Token::StripPrefix => f.write_str("{-}")?, - Token::ParentStripPrefix => f.write_str("{//-}")?, Token::Text(ref string) => f.write_str(string)?, } Ok(()) diff --git a/tests/tests.rs b/tests/tests.rs index 6110759..7c8d8ee 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -1363,16 +1363,6 @@ fn test_exec() { ); te.assert_output(&["e1", "--exec", "printf", "%s.%s\n"], "./e1 e2."); - - te.assert_output( - &["foo", "--exec", "echo", "{-}"], - "a.foo - one/b.foo - one/two/C.Foo2 - one/two/c.foo - one/two/three/d.foo - one/two/three/directory_foo", - ); } }