Capture --quote from the CLI

This commit is contained in:
Scott Baker 2023-08-23 08:33:53 -07:00
parent a248607bee
commit 83f1cbdeca
3 changed files with 12 additions and 0 deletions

View File

@ -621,6 +621,14 @@ pub struct Opts {
#[arg(long, aliases(&["mount", "xdev"]), hide_short_help = true, long_help)]
pub one_file_system: bool,
/// By default we output matched files/dirs raw. When the user specifies
/// --quote we output the files wrapped in quotes per the rules laid out
/// in coreutils: https://www.gnu.org/software/coreutils/quotes.html
/// This should mimic the `ls -lsa` output style
#[cfg(any(unix, windows))]
#[arg(long, aliases(&["quote"]), hide_short_help = true, long_help)]
pub use_quoting: bool,
#[cfg(feature = "completions")]
#[arg(long, hide = true, exclusive = true)]
gen_completions: Option<Option<Shell>>,

View File

@ -122,6 +122,9 @@ pub struct Config {
/// Whether or not to strip the './' prefix for search results
pub strip_cwd_prefix: bool,
/// Whether to use quoting on the output file names
pub use_quoting: bool,
}
impl Config {

View File

@ -249,6 +249,7 @@ fn construct_config(mut opts: Opts, pattern_regexps: &[String]) -> Result<Config
one_file_system: opts.one_file_system,
null_separator: opts.null_separator,
quiet: opts.quiet,
use_quoting: opts.use_quoting,
max_depth: opts.max_depth(),
min_depth: opts.min_depth(),
prune: opts.prune,