diff --git a/ChangeLog b/ChangeLog index 6fcee4887..e6c0270e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2002-02-08 Yoshinori K. Okuji + + * stage2/builtins.c (help_func): Show all the commands runnable + with the command-line interface, if "--all" is specified. + 2002-02-08 Yoshinori K. Okuji An internal pager is implemented. diff --git a/NEWS b/NEWS index 3a54f6310..7b10123c3 100644 --- a/NEWS +++ b/NEWS @@ -6,12 +6,11 @@ New in 0.92: the notation of data transfers. And, that is displayed only in debug mode, that is to say, nothing is displayed by default. Remember that you can turn on debug mode via the command "debug". -* The command "help" doesn't show all the available commands any longer, +* The command "help" doesn't show all the available commands by default, when no argument is specified. Rarely used commands (such as "testload") and useless commands in interactive use (such as "savedefault") are hidden. If you want to see help messages for those - commands, you will have to specify the names to "help" explicitly. - (Also, note that still shows all the commands.) + commands, specify the new option "--all". * A built-in, `more'-like pager is added. When a command prints too many lines to fit the screen, GRUB waits until you hit return key. This feature can be turned off by the new command "pager". diff --git a/stage2/builtins.c b/stage2/builtins.c index e88baddd6..15da71e18 100644 --- a/stage2/builtins.c +++ b/stage2/builtins.c @@ -1396,6 +1396,14 @@ static struct builtin builtin_halt = static int help_func (char *arg, int flags) { + int all = 0; + + if (grub_memcmp (arg, "--all", sizeof ("--all") - 1) == 0) + { + all = 1; + arg = skip_to (0, arg); + } + if (! *arg) { /* Invoked with no argument. Print the list of the short docs. */ @@ -1407,9 +1415,14 @@ help_func (char *arg, int flags) int len; int i; - /* If this doesn't need to be listed automatically, + /* If this cannot be used in the command-line interface, skip this. */ - if (! ((*builtin)->flags & BUILTIN_HELP_LIST)) + if (! ((*builtin)->flags & BUILTIN_CMDLINE)) + continue; + + /* If this doesn't need to be listed automatically and "--all" + is not specified, skip this. */ + if (! all && ! ((*builtin)->flags & BUILTIN_HELP_LIST)) continue; len = grub_strlen ((*builtin)->short_doc); @@ -1498,8 +1511,9 @@ static struct builtin builtin_help = "help", help_func, BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "help [PATTERN ...]", - "Display helpful information about builtin commands." + "help [--all] [PATTERN ...]", + "Display helpful information about builtin commands. Not all commands" + " aren't shown without the option `--all'." };