Fix 'help set/show style' strange layouts/results.
The layout for 'help set address|variable' is strange, e.g.:
(gdb) help set style address
style address
List of show Address display styling
Configure address colors and display intensity subcommands:
show Address display styling
Configure address colors and display intensity background -- Set the background color for this property
show Address display styling
Configure address colors and display intensity foreground -- Set the foreground color for this property
show Address display styling
Configure address colors and display intensity intensity -- Set the display intensity color for this property
Type "help show Address display styling
Configure address colors and display intensity" followed by show Address display styling
Configure address colors and display intensity subcommand name for full documentation.
Type "apropos word" to search for commands related to "word".
Command name abbreviations are allowed if unambiguous.
(gdb)
The help for 'set style function|filename' gives help for 'Show':
(gdb) help set style filename
Filename display styling
Configure filename colors and display intensity.
List of show style filename subcommands:
show style filename background -- Set the background color for this property
show style filename foreground -- Set the foreground color for this property
show style filename intensity -- Set the display intensity color for this property
The help for 'show style function|filename' is equally strange, as it speaks
about commands, instead of sub commands:
(gdb) help show style filename
Filename display styling
Configure filename colors and display intensity.
List of commands:
background -- Show the background color for this property
foreground -- Show the foreground color for this property
intensity -- Show the display intensity color for this property
Type "help" followed by command name for full documentation.
Type "apropos word" to search for commands related to "word".
Command name abbreviations are allowed if unambiguous.
(gdb)
This patch fixes all this.
Note that the 'set style' and 'show style' have the same prefix_doc:
(gdb) help show style
Style-specific settings
Configure various style-related variables, such as colors
...
(gdb) help set style
Style-specific settings
Configure various style-related variables, such as colors
...
Other similar commands (such as set|show history) have typically
a more specific prefix:
(gdb) help show history
Generic command for showing command history parameters.
...
(gdb) help set history
Generic command for setting command history parameters.
...
This could be fixed by having set_prefix_doc and show_prefix_doc instead of
the single prefix_doc argument to cli_style_option::add_setshow_commands.
That could be improved if deemed better.
2018-12-29 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* cli/cli-style.c (cli_style_option::add_setshow_commands):
Initialize m_set_prefix with "set", instead of re-assigning
m_show_prefix. Use m_set_prefix for set_list and m_show_prefix
for show_list.
(_initialize_cli_style): Correct the order of arguments in
variable_name_style.add_setshow_commands and
address_style.add_setshow_commands calls.