2002-02-08 Yoshinori K. Okuji <okuji@enbug.org>

* stage2/builtins.c (help_func): Show all the commands runnable
	with the command-line interface, if "--all" is specified.
This commit is contained in:
okuji 2002-02-08 01:22:36 +00:00
parent b0c95fd0d4
commit 479bc51947
3 changed files with 25 additions and 7 deletions

View file

@ -1,3 +1,8 @@
2002-02-08 Yoshinori K. Okuji <okuji@enbug.org>
* 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 <okuji@enbug.org> 2002-02-08 Yoshinori K. Okuji <okuji@enbug.org>
An internal pager is implemented. An internal pager is implemented.

5
NEWS
View file

@ -6,12 +6,11 @@ New in 0.92:
the notation of data transfers. And, that is displayed only in debug the notation of data transfers. And, that is displayed only in debug
mode, that is to say, nothing is displayed by default. Remember that mode, that is to say, nothing is displayed by default. Remember that
you can turn on debug mode via the command "debug". 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 when no argument is specified. Rarely used commands (such as
"testload") and useless commands in interactive use (such as "testload") and useless commands in interactive use (such as
"savedefault") are hidden. If you want to see help messages for those "savedefault") are hidden. If you want to see help messages for those
commands, you will have to specify the names to "help" explicitly. commands, specify the new option "--all".
(Also, note that <TAB> still shows all the commands.)
* A built-in, `more'-like pager is added. When a command prints too many * 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 lines to fit the screen, GRUB waits until you hit return key. This
feature can be turned off by the new command "pager". feature can be turned off by the new command "pager".

View file

@ -1396,6 +1396,14 @@ static struct builtin builtin_halt =
static int static int
help_func (char *arg, int flags) 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) if (! *arg)
{ {
/* Invoked with no argument. Print the list of the short docs. */ /* Invoked with no argument. Print the list of the short docs. */
@ -1407,9 +1415,14 @@ help_func (char *arg, int flags)
int len; int len;
int i; int i;
/* If this doesn't need to be listed automatically, /* If this cannot be used in the command-line interface,
skip this. */ 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; continue;
len = grub_strlen ((*builtin)->short_doc); len = grub_strlen ((*builtin)->short_doc);
@ -1498,8 +1511,9 @@ static struct builtin builtin_help =
"help", "help",
help_func, help_func,
BUILTIN_CMDLINE | BUILTIN_HELP_LIST, BUILTIN_CMDLINE | BUILTIN_HELP_LIST,
"help [PATTERN ...]", "help [--all] [PATTERN ...]",
"Display helpful information about builtin commands." "Display helpful information about builtin commands. Not all commands"
" aren't shown without the option `--all'."
}; };