From b1ba2495286ce78f28b848897f0ab259bfa7740a Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Thu, 18 Apr 2024 09:26:39 +0200 Subject: [PATCH] multicall: add --list to list all utils --- src/bin/coreutils.rs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/bin/coreutils.rs b/src/bin/coreutils.rs index fc2cd16add2..6edb70821df 100644 --- a/src/bin/coreutils.rs +++ b/src/bin/coreutils.rs @@ -90,13 +90,20 @@ fn main() { None => not_found(&util_os), }; - if util == "completion" { - gen_completions(args, &utils); - } - - if util == "manpage" { - gen_manpage(args, &utils); - } + match util { + "completion" => gen_completions(args, &utils), + "manpage" => gen_manpage(args, &utils), + "--list" => { + let mut utils: Vec<_> = utils.keys().collect(); + utils.sort(); + for util in utils { + println!("{util}"); + } + process::exit(0); + } + // Not a special command: fallthrough to calling a util + _ => {} + }; match utils.get(util) { Some(&(uumain, _)) => {