From 4f6157422f58cfed96aece5cc903616ec0fc758e Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Wed, 28 Dec 2022 15:19:30 -0600 Subject: [PATCH] Teach help -ah to skip invisible command aliases, and "See command" for OLDTOY() without independent help. --- main.c | 5 +++++ toys/other/help.c | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 9d9d7061..1982fcda 100644 --- a/main.c +++ b/main.c @@ -93,6 +93,11 @@ void show_help(FILE *out, int full) // If it's an alias, restart search for real name if (*s != 255) break; i = toy_find(++s)-toy_list; + if (full&4) { + fprintf(out, "See %s\n", s, s); + + return; + } } if (full) fprintf(out, "%s\n", s); diff --git a/toys/other/help.c b/toys/other/help.c index 1cdbe7e1..5a61f681 100644 --- a/toys/other/help.c +++ b/toys/other/help.c @@ -30,7 +30,7 @@ static void do_help(struct toy_list *t) xprintf("

%s

\n", t->name, t->name);
 
   toys.which = t;
-  show_help(stdout, !FLAG(u)+(!!toys.argv[1]<<1));
+  show_help(stdout, !FLAG(u)+(!!toys.argv[1]<<1)+(!!FLAG(h)<<2));
 
   if (FLAG(h)) xprintf("
\n"); } @@ -65,12 +65,14 @@ void help_main(void) sprintf(toybuf, "Toybox %s command help", toybox_version); xprintf("\n%s\n\n

%s


", toybuf, toybuf); - for (i=0; i < toys.toycount; i++) - xprintf("%s \n", toy_list[i].name, toy_list[i].name); + for (i=0; i%s \n", toy_list[i].name,toy_list[i].name); xprintf("

\n"); } for (i = 0; i < toys.toycount; i++) { + if (!toy_list[i].flags) continue; if (FLAG(h)) xprintf("
\n
\n");
     else if (!FLAG(u)) {
       memset(toybuf, '-', 78);
-- 
2.39.2