Fix/improve 'apropos' output
Similarly to 'help CLASS', apropos possibly shows several
times the same help (for the command and for each of its aliases).
This patch changes 'apropos' so that the help for a command and
all its aliases is shown once.
So, apropos_cmd now skips all aliases/abbreviations, as these are printed
as part of the help of the aliased command.
When 'apropos' prints the help of a command, function 'help_cmd' now
unconditionally print the command name and its possible aliases (as we must
indicate to the user the command/aliases for which the help is printed).
When 'help somecommand' prints the help of a command, if the command is not
aliased, the command name is not printed (to avoid a useless first line), but if
it has aliases, then the command name and all its aliases are now printed.
In addition to provide to the user the choice of the best way to
type a command, it also avoids the strange behaviour that the output
of 'help somealias' does not mention somealias.
gdb/ChangeLog
2020-05-15 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* cli/cli-decode.c (apropos_cmd): Produce output for aliases
when their aliased command is traversed.
(help_cmd): Add fput_command_names_styled call to
output command name and aliases when command has an alias.
gdb/testsuite/ChangeLog
2020-05-15 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.base/help.exp: Test apropos and help for commands
having aliases. Fixed comments not starting with an
upper-case letter or not finishing with a dot.