From 0335cc362b2c830c24b957504a7cb1f7cd623a44 Mon Sep 17 00:00:00 2001 From: sharkdp Date: Thu, 16 Apr 2020 10:11:05 +0200 Subject: [PATCH] Do not allow list-details in combination with -1 --- src/app.rs | 9 +++++++-- src/filesystem.rs | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/app.rs b/src/app.rs index 5704bb6..8c23e23 100644 --- a/src/app.rs +++ b/src/app.rs @@ -441,7 +441,12 @@ pub fn build_app() -> App<'static, 'static> { .long("max-results") .takes_value(true) .value_name("count") - .conflicts_with_all(&["exec", "exec-batch"]) + // We currently do not support --max-results in combination with + // program execution because the results that come up in a --max-results + // search are non-deterministic. Users might think that they can run the + // same search with `--exec rm` attached and get a reliable removal of + // the files they saw in the previous search. + .conflicts_with_all(&["exec", "exec-batch", "list-details"]) .hidden_short_help(true) .long_help("Limit the number of search results to 'count' and quit immediately."), ) @@ -450,7 +455,7 @@ pub fn build_app() -> App<'static, 'static> { .short("1") .hidden_short_help(true) .overrides_with("max-results") - .conflicts_with_all(&["exec", "exec-batch"]) + .conflicts_with_all(&["exec", "exec-batch", "list-details"]) .long_help("Limit the search to a single result and quit immediately. \ This is an alias for '--max-results=1'.") ) diff --git a/src/filesystem.rs b/src/filesystem.rs index a41fd58..a14f74d 100644 --- a/src/filesystem.rs +++ b/src/filesystem.rs @@ -4,7 +4,7 @@ use std::ffi::OsStr; use std::fs; use std::io; #[cfg(any(unix, target_os = "redox"))] -use std::os::unix::fs::{PermissionsExt, FileTypeExt}; +use std::os::unix::fs::{FileTypeExt, PermissionsExt}; use std::path::{Path, PathBuf}; use crate::walk;