diff options
author | Tom Tromey <tom@tromey.com> | 2024-05-18 11:35:32 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2024-12-12 20:18:23 -0700 |
commit | 9e69a2e127940cc577d4e0c6eefdfe33a31ea397 (patch) | |
tree | 2cd18c8f6560a6089bf1a88de3dcb86797a3c05d /gdb/cli | |
parent | 62e4d4d3ad68fe17113069b99d80a9ee9df87cb1 (diff) | |
download | binutils-9e69a2e127940cc577d4e0c6eefdfe33a31ea397.zip binutils-9e69a2e127940cc577d4e0c6eefdfe33a31ea397.tar.gz binutils-9e69a2e127940cc577d4e0c6eefdfe33a31ea397.tar.bz2 |
Introduce "command" styling
This adds a new "command" style that is used when styling the name of
a gdb command.
Note that not every instance of a command name that is output by gdb
is changed here. There is currently no way to style error() strings,
and there is no way to mark up command help strings.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31747
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Reviewed-By: Keith Seitz <keiths@redhat.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
Diffstat (limited to 'gdb/cli')
-rw-r--r-- | gdb/cli/cli-decode.c | 23 | ||||
-rw-r--r-- | gdb/cli/cli-style.c | 11 | ||||
-rw-r--r-- | gdb/cli/cli-style.h | 3 |
3 files changed, 29 insertions, 8 deletions
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index 163012a..2951194 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -1869,26 +1869,33 @@ help_list (struct cmd_list_element *list, const char *cmdtype, if (theclass == all_classes) { gdb_printf (stream, "\n\ -Type \"help%s\" followed by a class name for a list of commands in ", - cmdtype1); +Type \"%p[help%s%p]\" followed by a class name for a list of commands in ", + command_style.style ().ptr (), + cmdtype1, + nullptr); stream->wrap_here (0); gdb_printf (stream, "that class."); gdb_printf (stream, "\n\ -Type \"help all\" for the list of all commands."); +Type \"%ps\" for the list of all commands.", + styled_string (command_style.style (), "help all")); } - gdb_printf (stream, "\nType \"help%s\" followed by %scommand name ", - cmdtype1, cmdtype2); + gdb_printf (stream, "\nType \"%p[help%s%p]\" followed by %scommand name ", + command_style.style ().ptr (), cmdtype1, nullptr, + cmdtype2); stream->wrap_here (0); gdb_puts ("for ", stream); stream->wrap_here (0); gdb_puts ("full ", stream); stream->wrap_here (0); gdb_puts ("documentation.\n", stream); - gdb_puts ("Type \"apropos word\" to search " - "for commands related to \"word\".\n", stream); - gdb_puts ("Type \"apropos -v word\" for full documentation", stream); + gdb_printf (stream, + "Type \"%ps\" to search " + "for commands related to \"word\".\n", + styled_string (command_style.style (), "apropos word")); + gdb_printf (stream, "Type \"%ps\" for full documentation", + styled_string (command_style.style (), "apropos -v word")); stream->wrap_here (0); gdb_puts (" of commands related to \"word\".\n", stream); gdb_puts ("Command name abbreviations are allowed if unambiguous.\n", diff --git a/gdb/cli/cli-style.c b/gdb/cli/cli-style.c index 36a8bd9..fa582a7 100644 --- a/gdb/cli/cli-style.c +++ b/gdb/cli/cli-style.c @@ -91,6 +91,10 @@ cli_style_option title_style ("title", ui_file_style::BOLD); /* See cli-style.h. */ +cli_style_option command_style ("command", ui_file_style::BOLD); + +/* See cli-style.h. */ + cli_style_option tui_border_style ("tui-border", ui_file_style::CYAN); /* See cli-style.h. */ @@ -439,6 +443,13 @@ readability."), &style_set_list, &style_show_list, false); + command_style.add_setshow_commands (no_class, _("\ +Command display styling.\n\ +Configure the colors and display intensity for GDB commands mentioned\n\ +in the output."), + &style_set_list, &style_show_list, + false); + highlight_style.add_setshow_commands (no_class, _("\ Highlight display styling.\n\ Configure highlight colors and display intensity\n\ diff --git a/gdb/cli/cli-style.h b/gdb/cli/cli-style.h index 5052b86..24ec2ce 100644 --- a/gdb/cli/cli-style.h +++ b/gdb/cli/cli-style.h @@ -118,6 +118,9 @@ extern cli_style_option highlight_style; /* The title style. */ extern cli_style_option title_style; +/* Style used for commands. */ +extern cli_style_option command_style; + /* The metadata style. */ extern cli_style_option metadata_style; |