From 4e7e87baa280a0018fb842601d28ec702b663e0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christina=20S=C3=B8rensen?= Date: Sat, 28 Dec 2024 19:26:26 +0100 Subject: [PATCH] fix(quotes): integrate quotes flag with quote symlink fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christina Sørensen --- src/options/flags.rs | 6 +----- src/output/escape.rs | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/options/flags.rs b/src/options/flags.rs index d412babd9..1768ebb54 100644 --- a/src/options/flags.rs +++ b/src/options/flags.rs @@ -28,7 +28,6 @@ const ABSOLUTE_MODES: &[&str] = &["on", "follow", "off"]; pub static COLOR: Arg = Arg { short: None, long: "color", takes_value: TakesValue::Optional(Some(WHEN), "auto") }; pub static COLOUR: Arg = Arg { short: None, long: "colour", takes_value: TakesValue::Optional(Some(WHEN), "auto") }; -const WHEN: &[&str] = &["always", "auto", "never"]; pub static COLOR_SCALE: Arg = Arg { short: None, long: "color-scale", takes_value: TakesValue::Optional(Some(SCALES), "all") }; pub static COLOUR_SCALE: Arg = Arg { short: None, long: "colour-scale", takes_value: TakesValue::Optional(Some(SCALES), "all") }; @@ -52,9 +51,6 @@ pub static ONLY_DIRS: Arg = Arg { short: Some(b'D'), long: "only-dirs", takes_ pub static ONLY_FILES: Arg = Arg { short: Some(b'f'), long: "only-files", takes_value: TakesValue::Forbidden }; pub static NO_SYMLINKS: Arg = Arg { short: None, long: "no-symlinks", takes_value: TakesValue::Forbidden }; pub static SHOW_SYMLINKS: Arg = Arg { short: None, long: "show-symlinks", takes_value: TakesValue::Forbidden }; -const SORTS: Values = &[ "name", "Name", "size", "extension", - "Extension", "modified", "changed", "accessed", - "created", "inode", "type", "none" ]; // display options pub static BINARY: Arg = Arg { short: Some(b'b'), long: "binary", takes_value: TakesValue::Forbidden }; @@ -104,7 +100,7 @@ pub static ALL_ARGS: Args = Args(&[ &ONE_LINE, &LONG, &GRID, &ACROSS, &RECURSE, &TREE, &CLASSIFY, &DEREF_LINKS, &FOLLOW_LINKS, &COLOR, &COLOUR, &COLOR_SCALE, &COLOUR_SCALE, &COLOR_SCALE_MODE, &COLOUR_SCALE_MODE, - &WIDTH, &NO_QUOTES, &ABSOLUTE, "ES, + &WIDTH, &ABSOLUTE, "ES, &ALL, &ALMOST_ALL, &LIST_DIRS, &LEVEL, &REVERSE, &SORT, &DIRS_FIRST, &DIRS_LAST, &IGNORE_GLOB, &GIT_IGNORE, &ONLY_DIRS, &ONLY_FILES, diff --git a/src/output/escape.rs b/src/output/escape.rs index 39674112b..fb78c4eed 100644 --- a/src/output/escape.rs +++ b/src/output/escape.rs @@ -39,7 +39,7 @@ pub fn escape( } if quote_style != QuoteStyle::Never && needs_quotes || quote_style == QuoteStyle::Always { - bits.insert(0, quote_bit.clone()); + bits.insert(bits_starting_length, quote_bit.clone()); bits.push(quote_bit); } }