diff --git a/src/app.rs b/src/app.rs index 0ca1fb7..f6d7631 100644 --- a/src/app.rs +++ b/src/app.rs @@ -617,10 +617,10 @@ pub fn build_app() -> App<'static, 'static> { ), ) .arg( - Arg::with_name("strip-prefix") - .long("strip-prefix") - .short("P") + Arg::with_name("strip-cwd-prefix") + .long("strip-cwd-prefix") .conflicts_with_all(&["path", "search-path"]) + .hidden_short_help(true) .help("When no search path is provided and output is non-tty, strip './' prefix from results") .long_help( "By default, relative results are prefixed with './' when output to non-ttys. \ diff --git a/src/config.rs b/src/config.rs index 9719f72..91ca601 100644 --- a/src/config.rs +++ b/src/config.rs @@ -110,6 +110,6 @@ pub struct Config { /// The maximum number of search results pub max_results: Option, - /// Whether to prefix each relative path with "./" - pub no_strip: bool, + /// Whether or not to strip the './' prefix for search results + pub strip_cwd_prefix: bool, } diff --git a/src/main.rs b/src/main.rs index 3c09e88..974c561 100644 --- a/src/main.rs +++ b/src/main.rs @@ -375,9 +375,9 @@ fn construct_config(matches: clap::ArgMatches, pattern_regex: &str) -> Result, ) { - let path = if config.no_strip { - entry - } else { + let path = if config.strip_cwd_prefix { strip_current_dir(entry) + } else { + entry }; let r = if let Some(ref ls_colors) = config.ls_colors { diff --git a/tests/tests.rs b/tests/tests.rs index 90c0f9c..6110759 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -1925,11 +1925,11 @@ fn test_error_if_hidden_not_set_and_pattern_starts_with_dot() { } #[test] -fn test_no_strip() { +fn test_strip_cwd_prefix() { let te = TestEnv::new(DEFAULT_DIRS, DEFAULT_FILES); te.assert_output( - &["-P", "."], + &["--strip-cwd-prefix", "."], "a.foo e1 e2 one