From 7d44e96713f9af779f2426bf38c6463262395102 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 17 Jul 2023 22:34:03 +0200 Subject: [PATCH 1/2] coreutils multicall: Sort the command by alphabetic order (for the man) --- build.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.rs b/build.rs index 04948c0d382..09b33fa911f 100644 --- a/build.rs +++ b/build.rs @@ -38,14 +38,14 @@ pub fn main() { let mut mf = File::create(Path::new(&out_dir).join("uutils_map.rs")).unwrap(); mf.write_all( - "type UtilityMap = phf::Map<&'static str, (fn(T) -> i32, fn() -> Command)>;\n\ + "type UtilityMap = phf::OrderedMap<&'static str, (fn(T) -> i32, fn() -> Command)>;\n\ \n\ fn util_map() -> UtilityMap {\n" .as_bytes(), ) .unwrap(); - let mut phf_map = phf_codegen::Map::<&str>::new(); + let mut phf_map = phf_codegen::OrderedMap::<&str>::new(); for krate in &crates { let map_value = format!("({krate}::uumain, {krate}::uu_app)"); match krate.as_ref() { From 83c851714259939bd71c7743bec9f2190c67b06e Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 17 Jul 2023 22:40:54 +0200 Subject: [PATCH 2/2] coreutils multicall: the manpage subcommand doesn't display the right command see https://manpages.debian.org/unstable/rust-coreutils/rust-coreutils.1.en.html --- src/bin/coreutils.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/bin/coreutils.rs b/src/bin/coreutils.rs index 8440689c64b..d6487dc490e 100644 --- a/src/bin/coreutils.rs +++ b/src/bin/coreutils.rs @@ -212,8 +212,15 @@ fn gen_manpage( fn gen_coreutils_app(util_map: &UtilityMap) -> Command { let mut command = Command::new("coreutils"); - for (_, (_, sub_app)) in util_map { - command = command.subcommand(sub_app()); + for (name, (_, sub_app)) in util_map { + // Recreate a small subcommand with only the relevant info + // (name & short description) + let about = sub_app() + .get_about() + .expect("Could not get the 'about'") + .to_string(); + let sub_app = Command::new(name).about(about); + command = command.subcommand(sub_app); } command }