diff --git a/dev/search-index.js b/dev/search-index.js index 97834053e..3407d4881 100644 --- a/dev/search-index.js +++ b/dev/search-index.js @@ -106,9 +106,9 @@ var searchIndex = JSON.parse('{\ "uu_basenc":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_basenc",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ "uu_cat":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_cat",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ "uu_chcon":{"doc":"","t":[0,5,5,7,7,7,7,7,7,7,7,0,0,0,7,7,7,7,7,7,7],"n":["options","uu_app","uumain","HELP","RANGE","RECURSIVE","REFERENCE","ROLE","TYPE","USER","VERBOSE","dereference","preserve_root","sym_links","DEREFERENCE","NO_DEREFERENCE","NO_PRESERVE_ROOT","PRESERVE_ROOT","FOLLOW_ARG_DIR_SYM_LINK","FOLLOW_DIR_SYM_LINKS","NO_FOLLOW_SYM_LINKS"],"q":["uu_chcon","","","uu_chcon::options","","","","","","","","","","","uu_chcon::options::dereference","","uu_chcon::options::preserve_root","","uu_chcon::options::sym_links","",""],"d":["","","","","","","","","","","","","","","","","","","","",""],"i":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"f":[0,[[],1],[2,3],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ -"uu_chgrp":{"doc":"","t":[0,5,5,3,8,3,11,11,11,11,11,11,11,11,11,11,11,11,11,5,5,12,12,5,5,11,11,10,11,11,11,11,12,12,11,11,11,11,11,11,11,11,12,5,12,12,12,12,5],"n":["entries","uu_app","uumain","Group","Locate","Passwd","belongs_to","borrow","borrow","borrow_mut","borrow_mut","clone","clone","clone_into","clone_into","fmt","fmt","from","from","get_groups","get_groups_gnu","gid","gid","gid2grp","grp2gid","into","into","locate","locate","locate","locate","locate","name","name","to_owned","to_owned","try_from","try_from","try_into","try_into","type_id","type_id","uid","uid2usr","user_dir","user_info","user_passwd","user_shell","usr2uid"],"q":["uu_chgrp","","","uu_chgrp::entries","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"d":["Get password/group file entry","","","","Fetch desired entry.","","This is a wrapper function for libc::getgrouplist.","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","From: …","The list of group IDs returned from GNU’s groups and GNU…","AKA passwd.pw_gid","AKA group.gr_gid","","","Calls U::from(self).","Calls U::from(self).","","","","","","AKA passwd.pw_name","AKA group.gr_name","","","","","","","","","AKA passwd.pw_uid","","AKA passwd.pw_dir","AKA passwd.pw_gecos","AKA passwd.pw_passwd","AKA passwd.pw_shell",""],"i":[0,0,0,0,0,0,4,4,8,4,8,4,8,4,8,4,8,4,8,0,0,4,8,0,0,4,8,17,4,4,8,8,4,8,4,8,4,8,4,8,4,8,4,0,4,4,4,4,0],"f":[0,[[],1],[2,3],0,0,0,[4,[[7,[5,6]]]],[[]],[[]],[[]],[[]],[4,4],[8,8],[[]],[[]],[[4,9],[[11,[10]]]],[[8,9],[[11,[10]]]],[[]],[[]],[[],[[11,[[7,[5,6]],12]]]],[[[13,[5]]],[[11,[[7,[5,6]],12]]]],0,0,[5,[[11,[14,12]]]],[15,[[11,[5,12]]]],[[]],[[]],[[],[[11,[12]]]],[5,[[11,[4,12]]]],[15,[[11,[4,12]]]],[15,[[11,[8,12]]]],[5,[[11,[8,12]]]],0,0,[[]],[[]],[[],11],[[],11],[[],11],[[],11],[[],16],[[],16],0,[5,[[11,[14,12]]]],0,0,0,0,[15,[[11,[5,12]]]]],"p":[[3,"Command"],[8,"Args"],[15,"i32"],[3,"Passwd"],[15,"u32"],[3,"Global"],[3,"Vec"],[3,"Group"],[3,"Formatter"],[3,"Error"],[4,"Result"],[3,"Error"],[4,"Option"],[3,"String"],[15,"str"],[3,"TypeId"],[8,"Locate"]]},\ +"uu_chgrp":{"doc":"","t":[0,5,5,3,8,3,11,11,11,11,11,11,11,11,11,11,11,11,11,5,5,12,12,5,5,11,11,10,11,11,11,11,12,12,11,11,11,11,11,11,11,11,12,5,12,12,12,12,5],"n":["entries","uu_app","uumain","Group","Locate","Passwd","belongs_to","borrow","borrow","borrow_mut","borrow_mut","clone","clone","clone_into","clone_into","fmt","fmt","from","from","get_groups","get_groups_gnu","gid","gid","gid2grp","grp2gid","into","into","locate","locate","locate","locate","locate","name","name","to_owned","to_owned","try_from","try_from","try_into","try_into","type_id","type_id","uid","uid2usr","user_dir","user_info","user_passwd","user_shell","usr2uid"],"q":["uu_chgrp","","","uu_chgrp::entries","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"d":["Get password/group file entry","","","","Fetch desired entry.","","This is a wrapper function for libc::getgrouplist.","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","From: …","The list of group IDs returned from GNU’s groups and GNU…","AKA passwd.pw_gid","AKA group.gr_gid","","","Calls U::from(self).","Calls U::from(self).","","","","","","AKA passwd.pw_name","AKA group.gr_name","","","","","","","","","AKA passwd.pw_uid","","AKA passwd.pw_dir","AKA passwd.pw_gecos","AKA passwd.pw_passwd","AKA passwd.pw_shell",""],"i":[0,0,0,0,0,0,4,4,8,4,8,4,8,4,8,4,8,4,8,0,0,4,8,0,0,4,8,17,4,4,8,8,4,8,4,8,4,8,4,8,4,8,4,0,4,4,4,4,0],"f":[0,[[],1],[2,3],0,0,0,[4,[[7,[5,6]]]],[[]],[[]],[[]],[[]],[4,4],[8,8],[[]],[[]],[[4,9],[[11,[10]]]],[[8,9],[[11,[10]]]],[[]],[[]],[[],[[11,[[7,[5,6]],12]]]],[[[13,[5]]],[[11,[[7,[5,6]],12]]]],0,0,[5,[[11,[14,12]]]],[15,[[11,[5,12]]]],[[]],[[]],[[],[[11,[12]]]],[15,[[11,[4,12]]]],[5,[[11,[4,12]]]],[15,[[11,[8,12]]]],[5,[[11,[8,12]]]],0,0,[[]],[[]],[[],11],[[],11],[[],11],[[],11],[[],16],[[],16],0,[5,[[11,[14,12]]]],0,0,0,0,[15,[[11,[5,12]]]]],"p":[[3,"Command"],[8,"Args"],[15,"i32"],[3,"Passwd"],[15,"u32"],[3,"Global"],[3,"Vec"],[3,"Group"],[3,"Formatter"],[3,"Error"],[4,"Result"],[3,"Error"],[4,"Option"],[3,"String"],[15,"str"],[3,"TypeId"],[8,"Locate"]]},\ "uu_chmod":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_chmod",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ -"uu_chown":{"doc":"","t":[3,8,3,11,11,11,11,11,11,11,11,11,0,11,11,11,11,12,12,11,11,10,11,11,11,11,12,12,11,11,11,11,11,11,11,11,12,12,12,12,12,5,5,3,8,3,5,5,12,12,5,5,10,12,12,12,5,12,12,12,12,5],"n":["Group","Locate","Passwd","belongs_to","borrow","borrow","borrow_mut","borrow_mut","clone","clone","clone_into","clone_into","entries","fmt","fmt","from","from","gid","gid","into","into","locate","locate","locate","locate","locate","name","name","to_owned","to_owned","try_from","try_from","try_into","try_into","type_id","type_id","uid","user_dir","user_info","user_passwd","user_shell","uu_app","uumain","Group","Locate","Passwd","get_groups","get_groups_gnu","gid","gid","gid2grp","grp2gid","locate","name","name","uid","uid2usr","user_dir","user_info","user_passwd","user_shell","usr2uid"],"q":["uu_chown","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uu_chown::entries","","","","","","","","","","","","","","","","","",""],"d":["","Fetch desired entry.","","This is a wrapper function for libc::getgrouplist.","","","","","","","","","Get password/group file entry","","","Returns the argument unchanged.","Returns the argument unchanged.","AKA passwd.pw_gid","AKA group.gr_gid","Calls U::from(self).","Calls U::from(self).","","","","","","AKA passwd.pw_name","AKA group.gr_name","","","","","","","","","AKA passwd.pw_uid","AKA passwd.pw_dir","AKA passwd.pw_gecos","AKA passwd.pw_passwd","AKA passwd.pw_shell","","","","Fetch desired entry.","","From: …","The list of group IDs returned from GNU’s groups and GNU…","AKA passwd.pw_gid","AKA group.gr_gid","","","","AKA passwd.pw_name","AKA group.gr_name","AKA passwd.pw_uid","","AKA passwd.pw_dir","AKA passwd.pw_gecos","AKA passwd.pw_passwd","AKA passwd.pw_shell",""],"i":[0,0,0,1,1,5,1,5,1,5,1,5,0,1,5,1,5,1,5,1,5,17,1,1,5,5,1,5,1,5,1,5,1,5,1,5,1,1,1,1,1,0,0,0,0,0,0,0,1,5,0,0,17,1,5,1,0,1,1,1,1,0],"f":[0,0,0,[1,[[4,[2,3]]]],[[]],[[]],[[]],[[]],[1,1],[5,5],[[]],[[]],0,[[1,6],[[8,[7]]]],[[5,6],[[8,[7]]]],[[]],[[]],0,0,[[]],[[]],[[],[[8,[9]]]],[2,[[8,[1,9]]]],[10,[[8,[1,9]]]],[2,[[8,[5,9]]]],[10,[[8,[5,9]]]],0,0,[[]],[[]],[[],8],[[],8],[[],8],[[],8],[[],11],[[],11],0,0,0,0,0,[[],12],[13,14],0,0,0,[[],[[8,[[4,[2,3]],9]]]],[[[15,[2]]],[[8,[[4,[2,3]],9]]]],0,0,[2,[[8,[16,9]]]],[10,[[8,[2,9]]]],[[],[[8,[9]]]],0,0,0,[2,[[8,[16,9]]]],0,0,0,0,[10,[[8,[2,9]]]]],"p":[[3,"Passwd"],[15,"u32"],[3,"Global"],[3,"Vec"],[3,"Group"],[3,"Formatter"],[3,"Error"],[4,"Result"],[3,"Error"],[15,"str"],[3,"TypeId"],[3,"Command"],[8,"Args"],[15,"i32"],[4,"Option"],[3,"String"],[8,"Locate"]]},\ +"uu_chown":{"doc":"","t":[3,8,3,11,11,11,11,11,11,11,11,11,0,11,11,11,11,12,12,11,11,10,11,11,11,11,12,12,11,11,11,11,11,11,11,11,12,12,12,12,12,5,5,3,8,3,5,5,12,12,5,5,10,12,12,12,5,12,12,12,12,5],"n":["Group","Locate","Passwd","belongs_to","borrow","borrow","borrow_mut","borrow_mut","clone","clone","clone_into","clone_into","entries","fmt","fmt","from","from","gid","gid","into","into","locate","locate","locate","locate","locate","name","name","to_owned","to_owned","try_from","try_from","try_into","try_into","type_id","type_id","uid","user_dir","user_info","user_passwd","user_shell","uu_app","uumain","Group","Locate","Passwd","get_groups","get_groups_gnu","gid","gid","gid2grp","grp2gid","locate","name","name","uid","uid2usr","user_dir","user_info","user_passwd","user_shell","usr2uid"],"q":["uu_chown","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uu_chown::entries","","","","","","","","","","","","","","","","","",""],"d":["","Fetch desired entry.","","This is a wrapper function for libc::getgrouplist.","","","","","","","","","Get password/group file entry","","","Returns the argument unchanged.","Returns the argument unchanged.","AKA passwd.pw_gid","AKA group.gr_gid","Calls U::from(self).","Calls U::from(self).","","","","","","AKA passwd.pw_name","AKA group.gr_name","","","","","","","","","AKA passwd.pw_uid","AKA passwd.pw_dir","AKA passwd.pw_gecos","AKA passwd.pw_passwd","AKA passwd.pw_shell","","","","Fetch desired entry.","","From: …","The list of group IDs returned from GNU’s groups and GNU…","AKA passwd.pw_gid","AKA group.gr_gid","","","","AKA passwd.pw_name","AKA group.gr_name","AKA passwd.pw_uid","","AKA passwd.pw_dir","AKA passwd.pw_gecos","AKA passwd.pw_passwd","AKA passwd.pw_shell",""],"i":[0,0,0,1,1,5,1,5,1,5,1,5,0,1,5,1,5,1,5,1,5,17,1,1,5,5,1,5,1,5,1,5,1,5,1,5,1,1,1,1,1,0,0,0,0,0,0,0,1,5,0,0,17,1,5,1,0,1,1,1,1,0],"f":[0,0,0,[1,[[4,[2,3]]]],[[]],[[]],[[]],[[]],[1,1],[5,5],[[]],[[]],0,[[1,6],[[8,[7]]]],[[5,6],[[8,[7]]]],[[]],[[]],0,0,[[]],[[]],[[],[[8,[9]]]],[10,[[8,[1,9]]]],[2,[[8,[1,9]]]],[2,[[8,[5,9]]]],[10,[[8,[5,9]]]],0,0,[[]],[[]],[[],8],[[],8],[[],8],[[],8],[[],11],[[],11],0,0,0,0,0,[[],12],[13,14],0,0,0,[[],[[8,[[4,[2,3]],9]]]],[[[15,[2]]],[[8,[[4,[2,3]],9]]]],0,0,[2,[[8,[16,9]]]],[10,[[8,[2,9]]]],[[],[[8,[9]]]],0,0,0,[2,[[8,[16,9]]]],0,0,0,0,[10,[[8,[2,9]]]]],"p":[[3,"Passwd"],[15,"u32"],[3,"Global"],[3,"Vec"],[3,"Group"],[3,"Formatter"],[3,"Error"],[4,"Result"],[3,"Error"],[15,"str"],[3,"TypeId"],[3,"Command"],[8,"Args"],[15,"i32"],[4,"Option"],[3,"String"],[8,"Locate"]]},\ "uu_chroot":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_chroot",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ "uu_cksum":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_cksum",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ "uu_comm":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_comm",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ diff --git a/dev/src/uu_ls/ls.rs.html b/dev/src/uu_ls/ls.rs.html index f441abb23..f10a345c9 100644 --- a/dev/src/uu_ls/ls.rs.html +++ b/dev/src/uu_ls/ls.rs.html @@ -3048,6 +3048,70 @@ 3048 3049 3050 +3051 +3052 +3053 +3054 +3055 +3056 +3057 +3058 +3059 +3060 +3061 +3062 +3063 +3064 +3065 +3066 +3067 +3068 +3069 +3070 +3071 +3072 +3073 +3074 +3075 +3076 +3077 +3078 +3079 +3080 +3081 +3082 +3083 +3084 +3085 +3086 +3087 +3088 +3089 +3090 +3091 +3092 +3093 +3094 +3095 +3096 +3097 +3098 +3099 +3100 +3101 +3102 +3103 +3104 +3105 +3106 +3107 +3108 +3109 +3110 +3111 +3112 +3113 +3114
// This file is part of the uutils coreutils package.
 //
 // (c) Jeremiah Peschka <jeremiah.peschka@gmail.com>
@@ -3476,36 +3540,234 @@
     block_size: usize,
 }
 
+/// Extracts the format to display the information based on the options provided.
+///
+/// # Returns
+///
+/// A tuple containing the Format variant and an Option containing a &'static str
+/// which corresponds to the option used to define the format.
+fn extract_format(options: &clap::ArgMatches) -> (Format, Option<&'static str>) {
+    if let Some(format_) = options.get_one::<String>(options::FORMAT) {
+        (
+            match format_.as_str() {
+                "long" | "verbose" => Format::Long,
+                "single-column" => Format::OneLine,
+                "columns" | "vertical" => Format::Columns,
+                "across" | "horizontal" => Format::Across,
+                "commas" => Format::Commas,
+                // below should never happen as clap already restricts the values.
+                _ => unreachable!("Invalid field for --format"),
+            },
+            Some(options::FORMAT),
+        )
+    } else if options.get_flag(options::format::LONG) {
+        (Format::Long, Some(options::format::LONG))
+    } else if options.get_flag(options::format::ACROSS) {
+        (Format::Across, Some(options::format::ACROSS))
+    } else if options.get_flag(options::format::COMMAS) {
+        (Format::Commas, Some(options::format::COMMAS))
+    } else if options.get_flag(options::format::COLUMNS) {
+        (Format::Columns, Some(options::format::COLUMNS))
+    } else if std::io::stdout().is_terminal() {
+        (Format::Columns, None)
+    } else {
+        (Format::OneLine, None)
+    }
+}
+
+/// Extracts the type of files to display
+///
+/// # Returns
+///
+/// A Files variant representing the type of files to display.
+fn extract_files(options: &clap::ArgMatches) -> Files {
+    if options.get_flag(options::files::ALL) {
+        Files::All
+    } else if options.get_flag(options::files::ALMOST_ALL) {
+        Files::AlmostAll
+    } else {
+        Files::Normal
+    }
+}
+
+/// Extracts the sorting method to use based on the options provided.
+///
+/// # Returns
+///
+/// A Sort variant representing the sorting method to use.
+fn extract_sort(options: &clap::ArgMatches) -> Sort {
+    if let Some(field) = options.get_one::<String>(options::SORT) {
+        match field.as_str() {
+            "none" => Sort::None,
+            "name" => Sort::Name,
+            "time" => Sort::Time,
+            "size" => Sort::Size,
+            "version" => Sort::Version,
+            "extension" => Sort::Extension,
+            // below should never happen as clap already restricts the values.
+            _ => unreachable!("Invalid field for --sort"),
+        }
+    } else if options.get_flag(options::sort::TIME) {
+        Sort::Time
+    } else if options.get_flag(options::sort::SIZE) {
+        Sort::Size
+    } else if options.get_flag(options::sort::NONE) {
+        Sort::None
+    } else if options.get_flag(options::sort::VERSION) {
+        Sort::Version
+    } else if options.get_flag(options::sort::EXTENSION) {
+        Sort::Extension
+    } else {
+        Sort::Name
+    }
+}
+
+/// Extracts the time to use based on the options provided.
+///
+/// # Returns
+///
+/// A Time variant representing the time to use.
+fn extract_time(options: &clap::ArgMatches) -> Time {
+    if let Some(field) = options.get_one::<String>(options::TIME) {
+        match field.as_str() {
+            "ctime" | "status" => Time::Change,
+            "access" | "atime" | "use" => Time::Access,
+            "birth" | "creation" => Time::Birth,
+            // below should never happen as clap already restricts the values.
+            _ => unreachable!("Invalid field for --time"),
+        }
+    } else if options.get_flag(options::time::ACCESS) {
+        Time::Access
+    } else if options.get_flag(options::time::CHANGE) {
+        Time::Change
+    } else {
+        Time::Modification
+    }
+}
+
+/// Extracts the color option to use based on the options provided.
+///
+/// # Returns
+///
+/// A boolean representing whether or not to use color.
+fn extract_color(options: &clap::ArgMatches) -> bool {
+    match options.get_one::<String>(options::COLOR) {
+        None => options.contains_id(options::COLOR),
+        Some(val) => match val.as_str() {
+            "" | "always" | "yes" | "force" => true,
+            "auto" | "tty" | "if-tty" => std::io::stdout().is_terminal(),
+            /* "never" | "no" | "none" | */ _ => false,
+        },
+    }
+}
+
+/// Extracts the quoting style to use based on the options provided.
+///
+/// # Arguments
+///
+/// * `options` - A reference to a clap::ArgMatches object containing command line arguments.
+/// * `show_control` - A boolean value representing whether or not to show control characters.
+///
+/// # Returns
+///
+/// A QuotingStyle variant representing the quoting style to use.
+fn extract_quoting_style(options: &clap::ArgMatches, show_control: bool) -> QuotingStyle {
+    let opt_quoting_style = options
+        .get_one::<String>(options::QUOTING_STYLE)
+        .map(|cmd_line_qs| cmd_line_qs.to_owned());
+
+    if let Some(style) = opt_quoting_style {
+        match style.as_str() {
+            "literal" => QuotingStyle::Literal { show_control },
+            "shell" => QuotingStyle::Shell {
+                escape: false,
+                always_quote: false,
+                show_control,
+            },
+            "shell-always" => QuotingStyle::Shell {
+                escape: false,
+                always_quote: true,
+                show_control,
+            },
+            "shell-escape" => QuotingStyle::Shell {
+                escape: true,
+                always_quote: false,
+                show_control,
+            },
+            "shell-escape-always" => QuotingStyle::Shell {
+                escape: true,
+                always_quote: true,
+                show_control,
+            },
+            "c" => QuotingStyle::C {
+                quotes: quoting_style::Quotes::Double,
+            },
+            "escape" => QuotingStyle::C {
+                quotes: quoting_style::Quotes::None,
+            },
+            _ => unreachable!("Should have been caught by Clap"),
+        }
+    } else if options.get_flag(options::quoting::LITERAL) {
+        QuotingStyle::Literal { show_control }
+    } else if options.get_flag(options::quoting::ESCAPE) {
+        QuotingStyle::C {
+            quotes: quoting_style::Quotes::None,
+        }
+    } else if options.get_flag(options::quoting::C) {
+        QuotingStyle::C {
+            quotes: quoting_style::Quotes::Double,
+        }
+    } else {
+        // TODO: use environment variable if available
+        QuotingStyle::Shell {
+            escape: true,
+            always_quote: false,
+            show_control,
+        }
+    }
+}
+
+/// Extracts the indicator style to use based on the options provided.
+///
+/// # Returns
+///
+/// An IndicatorStyle variant representing the indicator style to use.
+fn extract_indicator_style(options: &clap::ArgMatches) -> IndicatorStyle {
+    if let Some(field) = options.get_one::<String>(options::INDICATOR_STYLE) {
+        match field.as_str() {
+            "none" => IndicatorStyle::None,
+            "file-type" => IndicatorStyle::FileType,
+            "classify" => IndicatorStyle::Classify,
+            "slash" => IndicatorStyle::Slash,
+            &_ => IndicatorStyle::None,
+        }
+    } else if let Some(field) = options.get_one::<String>(options::indicator_style::CLASSIFY) {
+        match field.as_str() {
+            "never" | "no" | "none" => IndicatorStyle::None,
+            "always" | "yes" | "force" => IndicatorStyle::Classify,
+            "auto" | "tty" | "if-tty" => {
+                if std::io::stdout().is_terminal() {
+                    IndicatorStyle::Classify
+                } else {
+                    IndicatorStyle::None
+                }
+            }
+            &_ => IndicatorStyle::None,
+        }
+    } else if options.get_flag(options::indicator_style::SLASH) {
+        IndicatorStyle::Slash
+    } else if options.get_flag(options::indicator_style::FILE_TYPE) {
+        IndicatorStyle::FileType
+    } else {
+        IndicatorStyle::None
+    }
+}
+
 impl Config {
-    #[allow(clippy::cognitive_complexity)]
-    pub fn from(options: &clap::ArgMatches) -> UResult<Self> {
+    pub fn from(options: &clap::ArgMatches) -> UResult<Self> {
         let context = options.get_flag(options::CONTEXT);
-        let (mut format, opt) = if let Some(format_) = options.get_one::<String>(options::FORMAT) {
-            (
-                match format_.as_str() {
-                    "long" | "verbose" => Format::Long,
-                    "single-column" => Format::OneLine,
-                    "columns" | "vertical" => Format::Columns,
-                    "across" | "horizontal" => Format::Across,
-                    "commas" => Format::Commas,
-                    // below should never happen as clap already restricts the values.
-                    _ => unreachable!("Invalid field for --format"),
-                },
-                Some(options::FORMAT),
-            )
-        } else if options.get_flag(options::format::LONG) {
-            (Format::Long, Some(options::format::LONG))
-        } else if options.get_flag(options::format::ACROSS) {
-            (Format::Across, Some(options::format::ACROSS))
-        } else if options.get_flag(options::format::COMMAS) {
-            (Format::Commas, Some(options::format::COMMAS))
-        } else if options.get_flag(options::format::COLUMNS) {
-            (Format::Columns, Some(options::format::COLUMNS))
-        } else if std::io::stdout().is_terminal() {
-            (Format::Columns, None)
-        } else {
-            (Format::OneLine, None)
-        };
+        let (mut format, opt) = extract_format(options);
+        let files = extract_files(options);
 
         // The -o, -n and -g options are tricky. They cannot override with each
         // other because it's possible to combine them. For example, the option
@@ -3554,63 +3816,11 @@
             }
         }
 
-        let files = if options.get_flag(options::files::ALL) {
-            Files::All
-        } else if options.get_flag(options::files::ALMOST_ALL) {
-            Files::AlmostAll
-        } else {
-            Files::Normal
-        };
+        let sort = extract_sort(options);
 
-        let sort = if let Some(field) = options.get_one::<String>(options::SORT) {
-            match field.as_str() {
-                "none" => Sort::None,
-                "name" => Sort::Name,
-                "time" => Sort::Time,
-                "size" => Sort::Size,
-                "version" => Sort::Version,
-                "extension" => Sort::Extension,
-                // below should never happen as clap already restricts the values.
-                _ => unreachable!("Invalid field for --sort"),
-            }
-        } else if options.get_flag(options::sort::TIME) {
-            Sort::Time
-        } else if options.get_flag(options::sort::SIZE) {
-            Sort::Size
-        } else if options.get_flag(options::sort::NONE) {
-            Sort::None
-        } else if options.get_flag(options::sort::VERSION) {
-            Sort::Version
-        } else if options.get_flag(options::sort::EXTENSION) {
-            Sort::Extension
-        } else {
-            Sort::Name
-        };
+        let time = extract_time(options);
 
-        let time = if let Some(field) = options.get_one::<String>(options::TIME) {
-            match field.as_str() {
-                "ctime" | "status" => Time::Change,
-                "access" | "atime" | "use" => Time::Access,
-                "birth" | "creation" => Time::Birth,
-                // below should never happen as clap already restricts the values.
-                _ => unreachable!("Invalid field for --time"),
-            }
-        } else if options.get_flag(options::time::ACCESS) {
-            Time::Access
-        } else if options.get_flag(options::time::CHANGE) {
-            Time::Change
-        } else {
-            Time::Modification
-        };
-
-        let mut needs_color = match options.get_one::<String>(options::COLOR) {
-            None => options.contains_id(options::COLOR),
-            Some(val) => match val.as_str() {
-                "" | "always" | "yes" | "force" => true,
-                "auto" | "tty" | "if-tty" => std::io::stdout().is_terminal(),
-                /* "never" | "no" | "none" | */ _ => false,
-            },
-        };
+        let mut needs_color = extract_color(options);
 
         let cmd_line_bs = options.get_one::<String>(options::size::BLOCK_SIZE);
         let opt_si = cmd_line_bs.is_some()
@@ -3731,90 +3941,8 @@
             !std::io::stdout().is_terminal()
         };
 
-        let opt_quoting_style = options
-            .get_one::<String>(options::QUOTING_STYLE)
-            .map(|cmd_line_qs| cmd_line_qs.to_owned());
-
-        let mut quoting_style = if let Some(style) = opt_quoting_style {
-            match style.as_str() {
-                "literal" => QuotingStyle::Literal { show_control },
-                "shell" => QuotingStyle::Shell {
-                    escape: false,
-                    always_quote: false,
-                    show_control,
-                },
-                "shell-always" => QuotingStyle::Shell {
-                    escape: false,
-                    always_quote: true,
-                    show_control,
-                },
-                "shell-escape" => QuotingStyle::Shell {
-                    escape: true,
-                    always_quote: false,
-                    show_control,
-                },
-                "shell-escape-always" => QuotingStyle::Shell {
-                    escape: true,
-                    always_quote: true,
-                    show_control,
-                },
-                "c" => QuotingStyle::C {
-                    quotes: quoting_style::Quotes::Double,
-                },
-                "escape" => QuotingStyle::C {
-                    quotes: quoting_style::Quotes::None,
-                },
-                _ => unreachable!("Should have been caught by Clap"),
-            }
-        } else if options.get_flag(options::quoting::LITERAL) {
-            QuotingStyle::Literal { show_control }
-        } else if options.get_flag(options::quoting::ESCAPE) {
-            QuotingStyle::C {
-                quotes: quoting_style::Quotes::None,
-            }
-        } else if options.get_flag(options::quoting::C) {
-            QuotingStyle::C {
-                quotes: quoting_style::Quotes::Double,
-            }
-        } else {
-            // TODO: use environment variable if available
-            QuotingStyle::Shell {
-                escape: true,
-                always_quote: false,
-                show_control,
-            }
-        };
-
-        let indicator_style = if let Some(field) =
-            options.get_one::<String>(options::INDICATOR_STYLE)
-        {
-            match field.as_str() {
-                "none" => IndicatorStyle::None,
-                "file-type" => IndicatorStyle::FileType,
-                "classify" => IndicatorStyle::Classify,
-                "slash" => IndicatorStyle::Slash,
-                &_ => IndicatorStyle::None,
-            }
-        } else if let Some(field) = options.get_one::<String>(options::indicator_style::CLASSIFY) {
-            match field.as_str() {
-                "never" | "no" | "none" => IndicatorStyle::None,
-                "always" | "yes" | "force" => IndicatorStyle::Classify,
-                "auto" | "tty" | "if-tty" => {
-                    if std::io::stdout().is_terminal() {
-                        IndicatorStyle::Classify
-                    } else {
-                        IndicatorStyle::None
-                    }
-                }
-                &_ => IndicatorStyle::None,
-            }
-        } else if options.get_flag(options::indicator_style::SLASH) {
-            IndicatorStyle::Slash
-        } else if options.get_flag(options::indicator_style::FILE_TYPE) {
-            IndicatorStyle::FileType
-        } else {
-            IndicatorStyle::None
-        };
+        let mut quoting_style = extract_quoting_style(options, show_control);
+        let indicator_style = extract_indicator_style(options);
         let time_style = parse_time_style(options)?;
 
         let mut ignore_patterns: Vec<Pattern> = Vec::new();
diff --git a/dev/uu_chgrp/entries/struct.Passwd.html b/dev/uu_chgrp/entries/struct.Passwd.html
index 08891c959..529d213c9 100644
--- a/dev/uu_chgrp/entries/struct.Passwd.html
+++ b/dev/uu_chgrp/entries/struct.Passwd.html
@@ -27,7 +27,7 @@ call getgrouplist().

not update ngroups if ngroups is too small. Therefore, if not updated by getgrouplist, ngroups needs to be increased in a loop until getgrouplist stops returning -1.

-

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

diff --git a/dev/uu_chown/entries/struct.Passwd.html b/dev/uu_chown/entries/struct.Passwd.html index 60c8bd02b..e55c50dab 100644 --- a/dev/uu_chown/entries/struct.Passwd.html +++ b/dev/uu_chown/entries/struct.Passwd.html @@ -27,7 +27,7 @@ call getgrouplist().

not update ngroups if ngroups is too small. Therefore, if not updated by getgrouplist, ngroups needs to be increased in a loop until getgrouplist stops returning -1.

-

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

diff --git a/dev/uu_chown/struct.Passwd.html b/dev/uu_chown/struct.Passwd.html index d376ca95c..ac3d2f10a 100644 --- a/dev/uu_chown/struct.Passwd.html +++ b/dev/uu_chown/struct.Passwd.html @@ -27,7 +27,7 @@ call getgrouplist().

not update ngroups if ngroups is too small. Therefore, if not updated by getgrouplist, ngroups needs to be increased in a loop until getgrouplist stops returning -1.

-

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

diff --git a/dev/uu_ls/fn.list.html b/dev/uu_ls/fn.list.html index 842ccd0a4..b0b95dbb3 100644 --- a/dev/uu_ls/fn.list.html +++ b/dev/uu_ls/fn.list.html @@ -1 +1 @@ -list in uu_ls - Rust

Function uu_ls::list

source ·
pub fn list(locs: Vec<&Path>, config: &Config) -> UResult<()>
\ No newline at end of file +list in uu_ls - Rust

Function uu_ls::list

source ·
pub fn list(locs: Vec<&Path>, config: &Config) -> UResult<()>
\ No newline at end of file diff --git a/dev/uu_ls/fn.uu_app.html b/dev/uu_ls/fn.uu_app.html index 278ade4de..7d31725cb 100644 --- a/dev/uu_ls/fn.uu_app.html +++ b/dev/uu_ls/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_ls - Rust

Function uu_ls::uu_app

source ·
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_ls - Rust

Function uu_ls::uu_app

source ·
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_ls/fn.uumain.html b/dev/uu_ls/fn.uumain.html index 333aa45ce..103c19351 100644 --- a/dev/uu_ls/fn.uumain.html +++ b/dev/uu_ls/fn.uumain.html @@ -1 +1 @@ -uumain in uu_ls - Rust

Function uu_ls::uumain

source ·
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_ls - Rust

Function uu_ls::uumain

source ·
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_ls/index.html b/dev/uu_ls/index.html index cee82eb1d..44374bf1b 100644 --- a/dev/uu_ls/index.html +++ b/dev/uu_ls/index.html @@ -1 +1 @@ -uu_ls - Rust
\ No newline at end of file +uu_ls - Rust
\ No newline at end of file diff --git a/dev/uu_ls/struct.Config.html b/dev/uu_ls/struct.Config.html index 162bde162..34517de2c 100644 --- a/dev/uu_ls/struct.Config.html +++ b/dev/uu_ls/struct.Config.html @@ -2,7 +2,7 @@ pub format: Format, pub quoting_style: QuotingStyle, /* private fields */ -}

Fields§

§format: Format§quoting_style: QuotingStyle

Implementations§

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+}

Fields§

§format: Format§quoting_style: QuotingStyle

Implementations§

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.