[PATCH] Use title style in help_list

Philippe Waroquiers philippe.waroquiers@skynet.be
Fri Apr 24 15:24:44 GMT 2020


Hello Tom,

I tried the patch, the added styling increases the readability.
Thanks for this.

One comment:
I find the new
  Type "help" followed by the appropriate command name for full documentation.
longer and less clear than the old
  Type "help" followed by command name for full documentation.
because "the appropriate" makes my brain start to think about what would
be an inappropriate command name there, and what would instead
be an appropriate command.

So, I would just keep the old text, or maybe just add "a", to have:
  Type "help" followed by a command name for full documentation.
so as to have it similar to e.g.
  Type "help" followed by a class name for a list of commands in that class.

Thanks
Philippe

On Fri, 2020-04-24 at 08:46 -0600, Tom Tromey wrote:
> From: Tom Tromey <tom@tromey.com>
> 
> This changes help_list to use "title" style, so that more commands
> mentioned in their output are styled for the user.  This also slightly
> changes the output here -- for the better, I think, because now it is
> more i18n-friendly.
> 
> gdb/ChangeLog
> 2020-04-16  Tom Tromey  <tromey@adacore.com>
> 
> 	* cli/cli-decode.c (help_list): Use title style.
> 
> gdb/testsuite/ChangeLog
> 2020-04-24  Tom Tromey  <tromey@adacore.com>
> 
> 	* gdb.base/page.exp: Update expected output.
> 	* lib/gdb.exp (test_class_help): Update expected output.
> 	(test_prefix_command_help): Likewise.
> 	* gdb.base/default.exp: Update expected output.
> ---
>  gdb/ChangeLog                      |  4 +++
>  gdb/cli/cli-decode.c               | 39 ++++++++++++++----------------
>  gdb/testsuite/ChangeLog            |  7 ++++++
>  gdb/testsuite/gdb.base/default.exp | 20 +++++++--------
>  gdb/testsuite/gdb.base/page.exp    |  2 +-
>  gdb/testsuite/lib/gdb.exp          |  4 +--
>  6 files changed, 42 insertions(+), 34 deletions(-)
> 
> diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
> index 17f49ec80e4..32774821a8b 100644
> --- a/gdb/cli/cli-decode.c
> +++ b/gdb/cli/cli-decode.c
> @@ -1200,29 +1200,26 @@ help_list (struct cmd_list_element *list, const char *cmdtype,
>  
>    if (theclass == all_classes)
>      {
> -      fprintf_filtered (stream, "\n\
> -Type \"help%s\" followed by a class name for a list of commands in ",
> -			cmdtype1);
> -      wrap_here ("");
> -      fprintf_filtered (stream, "that class.");
> -
> -      fprintf_filtered (stream, "\n\
> -Type \"help all\" for the list of all commands.");
> +      fprintf_filtered (stream, _("\n\
> +Type \"%p[help%s%p]\" followed by a class name for a list of commands "
> +				  "in that class.\n"),
> +			title_style.style ().ptr (), cmdtype1, nullptr);
> +
> +      fprintf_filtered (stream,
> +			_("Type \"%ps\" for the list of all commands."),
> +			styled_string (title_style.style (), "help all"));
>      }
>  
> -  fprintf_filtered (stream, "\nType \"help%s\" followed by %scommand name ",
> -		    cmdtype1, cmdtype2);
> -  wrap_here ("");
> -  fputs_filtered ("for ", stream);
> -  wrap_here ("");
> -  fputs_filtered ("full ", stream);
> -  wrap_here ("");
> -  fputs_filtered ("documentation.\n", stream);
> -  fputs_filtered ("Type \"apropos word\" to search "
> -		  "for commands related to \"word\".\n", stream);
> -  fputs_filtered ("Type \"apropos -v word\" for full documentation", stream);
> -  wrap_here ("");
> -  fputs_filtered (" of commands related to \"word\".\n", stream);
> +  fprintf_filtered (stream, _("\nType \"%p[help%s%p]\" followed by the appropriate "
> +			      "command name for full documentation.\n"),
> +		    title_style.style ().ptr (), cmdtype1, nullptr);
> +
> +  fprintf_filtered (stream, _("Type \"%ps word\" to search "
> +			      "for commands related to \"word\".\n"),
> +		    styled_string (title_style.style (), "apropos"));
> +  fprintf_filtered (stream, _("Type \"%ps word\" for full documentation"
> +			      " of commands related to \"word\".\n"),
> +		    styled_string (title_style.style (), "apropos -v"));
>    fputs_filtered ("Command name abbreviations are allowed if unambiguous.\n",
>  		  stream);
>  }
> diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp
> index 846c91af6bc..a70a6181213 100644
> --- a/gdb/testsuite/gdb.base/default.exp
> +++ b/gdb/testsuite/gdb.base/default.exp
> @@ -247,15 +247,15 @@ gdb_test_multiple "generate-core-file" "generate-core-file" {
>  }
>  
>  #test help "h" abbreviation
> -gdb_test "h" "List of classes of commands:(\[^\r\n\]*\[\r\n\])+aliases -- Aliases of other commands(\[^\r\n\]*\[\r\n\])+breakpoints -- Making program stop at certain points(\[^\r\n\]*\[\r\n\])+data -- Examining data(\[^\r\n\]*\[\r\n\])+files -- Specifying and examining files(\[^\r\n\]*\[\r\n\])+obscure -- Obscure features(\[^\r\n\]*\[\r\n\])+running -- Running the program(\[^\r\n\]*\[\r\n\])+stack -- Examining the stack(\[^\r\n\]*\[\r\n\])+status -- Status inquiries(\[^\r\n\]*\[\r\n\])+support -- Support facilities(\[^\r\n\]*\[\r\n\])+user-defined -- User-defined commands(\[^\r\n\]*\[\r\n\])+Type \"help\" followed by a class name for a list of commands in that class.(\[^\r\n\]*\[\r\n\])+Type \"help\" followed by command name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "help \"h\" abbreviation"
> +gdb_test "h" "List of classes of commands:(\[^\r\n\]*\[\r\n\])+aliases -- Aliases of other commands(\[^\r\n\]*\[\r\n\])+breakpoints -- Making program stop at certain points(\[^\r\n\]*\[\r\n\])+data -- Examining data(\[^\r\n\]*\[\r\n\])+files -- Specifying and examining files(\[^\r\n\]*\[\r\n\])+obscure -- Obscure features(\[^\r\n\]*\[\r\n\])+running -- Running the program(\[^\r\n\]*\[\r\n\])+stack -- Examining the stack(\[^\r\n\]*\[\r\n\])+status -- Status inquiries(\[^\r\n\]*\[\r\n\])+support -- Support facilities(\[^\r\n\]*\[\r\n\])+user-defined -- User-defined commands(\[^\r\n\]*\[\r\n\])+Type \"help\" followed by a class name for a list of commands in that class.(\[^\r\n\]*\[\r\n\])+Type \"help\" followed by the appropriate command name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "help \"h\" abbreviation"
>  #test help
> -gdb_test "help" "List of classes of commands:(\[^\r\n\]*\[\r\n\])+aliases -- Aliases of other commands(\[^\r\n\]*\[\r\n\])+breakpoints -- Making program stop at certain points(\[^\r\n\]*\[\r\n\])+data -- Examining data(\[^\r\n\]*\[\r\n\])+files -- Specifying and examining files(\[^\r\n\]*\[\r\n\])+obscure -- Obscure features(\[^\r\n\]*\[\r\n\])+running -- Running the program(\[^\r\n\]*\[\r\n\])+stack -- Examining the stack(\[^\r\n\]*\[\r\n\])+status -- Status inquiries(\[^\r\n\]*\[\r\n\])+support -- Support facilities(\[^\r\n\]*\[\r\n\])+user-defined -- User-defined commands(\[^\r\n\]*\[\r\n\])+Type \"help\" followed by a class name for a list of commands in that class.(\[^\r\n\]*\[\r\n\])+Type \"help\" followed by command name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous."
> +gdb_test "help" "List of classes of commands:(\[^\r\n\]*\[\r\n\])+aliases -- Aliases of other commands(\[^\r\n\]*\[\r\n\])+breakpoints -- Making program stop at certain points(\[^\r\n\]*\[\r\n\])+data -- Examining data(\[^\r\n\]*\[\r\n\])+files -- Specifying and examining files(\[^\r\n\]*\[\r\n\])+obscure -- Obscure features(\[^\r\n\]*\[\r\n\])+running -- Running the program(\[^\r\n\]*\[\r\n\])+stack -- Examining the stack(\[^\r\n\]*\[\r\n\])+status -- Status inquiries(\[^\r\n\]*\[\r\n\])+support -- Support facilities(\[^\r\n\]*\[\r\n\])+user-defined -- User-defined commands(\[^\r\n\]*\[\r\n\])+Type \"help\" followed by a class name for a list of commands in that class.(\[^\r\n\]*\[\r\n\])+Type \"help\" followed by the appropriate command name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous."
>  #test handle
>  gdb_test "handle" "Argument required .signal to handle.*"
>  #test info "i" abbreviation 
> -gdb_test "i" "List of info subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help info\" followed by info subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "info \"i\" abbreviation"
> +gdb_test "i" "List of info subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help info\" followed by the appropriate command name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "info \"i\" abbreviation"
>  #test info
> -gdb_test "info" "List of info subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help info\" followed by info subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous."
> +gdb_test "info" "List of info subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help info\" followed by the appropriate command name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous."
>  #test ignore
>  gdb_test "ignore" "Argument required .a breakpoint number.*"
>  #test info address
> @@ -475,7 +475,7 @@ gdb_test_no_output "set args" "set args"
>  
>  # Test set check abbreviations
>  foreach x {"c" "ch" "check"} {
> -    gdb_test "set $x" "List of set check subcommands:(\[^\r\n\]*\[\r\n\])+set check range -- Set range checking(\[^\r\n\]*\[\r\n\])+set check type -- Set strict type checking(\[^\r\n\]*\[\r\n\])+Type \"help set check\" followed by set check subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." \
> +    gdb_test "set $x" "List of set check subcommands:(\[^\r\n\]*\[\r\n\])+set check range -- Set range checking(\[^\r\n\]*\[\r\n\])+set check type -- Set strict type checking(\[^\r\n\]*\[\r\n\])+Type \"help set check\" followed by the appropriate command name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." \
>  	"set check \"$x\" abbreviation"
>  }
>  
> @@ -505,17 +505,17 @@ gdb_test_no_output "set history save" "set history save"
>  #test set history size
>  gdb_test "set history size" "Argument required .integer to set it to.*"
>  #test set history
> -gdb_test "set history" "List of set history subcommands:(\[^\r\n\]*\[\r\n\])+set history expansion -- Set history expansion on command input(\[^\r\n\]*\[\r\n\])+set history filename -- Set the filename in which to record the command history(\[^\r\n\]*\[\r\n\])+set history save -- Set saving of the history record on exit(\[^\r\n\]*\[\r\n\])+set history size -- Set the size of the command history(\[^\r\n\]*\[\r\n\])+Type \"help set history\" followed by set history subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous."
> +gdb_test "set history" "List of set history subcommands:(\[^\r\n\]*\[\r\n\])+set history expansion -- Set history expansion on command input(\[^\r\n\]*\[\r\n\])+set history filename -- Set the filename in which to record the command history(\[^\r\n\]*\[\r\n\])+set history save -- Set saving of the history record on exit(\[^\r\n\]*\[\r\n\])+set history size -- Set the size of the command history(\[^\r\n\]*\[\r\n\])+Type \"help set history\" followed by the appropriate command name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous."
>  #test set language
>  gdb_test "set language" "Requires an argument. Valid arguments are auto, local, unknown, ada, asm, c, c.., d, fortran, go, minimal, modula-2, objective-c, opencl, pascal, rust."
>  #test set listsize
>  gdb_test "set listsize" "Argument required .integer to set it to.*"
>  #test set print "p" abbreviation
> -gdb_test "set p" "List of set print subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help set print\" followed by set print subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set print \"p\" abbreviation"
> +gdb_test "set p" "List of set print subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help set print\" followed by the appropriate command name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set print \"p\" abbreviation"
>  #test set print "pr" abbreviation
> -gdb_test "set pr" "List of set print subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help set print\" followed by set print subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set print \"pr\" abbreviation"
> +gdb_test "set pr" "List of set print subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help set print\" followed by the appropriate command name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set print \"pr\" abbreviation"
>  #test set print
> -gdb_test "set print" "List of set print subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help set print\" followed by set print subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous."
> +gdb_test "set print" "List of set print subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help set print\" followed by the appropriate command name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous."
>  #test set print address
>  gdb_test_no_output "set print address" "set print address"
>  #test set print array
> @@ -827,7 +827,7 @@ gdb_test "unset environment" \
>      "y"
>  
>  #test unset
> -gdb_test "unset" "List of unset subcommands:(\[^\r\n\]*\[\r\n\])+unset environment -- Cancel environment variable VAR for the program(\[^\r\n\]*\[\r\n\])+Type \"help unset\" followed by unset subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous."
> +gdb_test "unset" "List of unset subcommands:(\[^\r\n\]*\[\r\n\])+unset environment -- Cancel environment variable VAR for the program(\[^\r\n\]*\[\r\n\])+Type \"help unset\" followed by the appropriate command name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous."
>  #test up
>  #test up-silently
>  gdb_test "up-silently" "No stack."
> diff --git a/gdb/testsuite/gdb.base/page.exp b/gdb/testsuite/gdb.base/page.exp
> index c34c886c644..a41a0990821 100644
> --- a/gdb/testsuite/gdb.base/page.exp
> +++ b/gdb/testsuite/gdb.base/page.exp
> @@ -37,7 +37,7 @@ gdb_test_sequence "help" "unpaged help" {
>      "user-defined -- User-defined commands"
>      ""
>      "Type .help. followed by a class name for a list of commands in that class."
> -    "Type .help. followed by command name for full documentation."
> +    "Type .help. followed by the appropriate command name for full documentation."
>      "Command name abbreviations are allowed if unambiguous."
>  }
>  
> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
> index cdf96e3c703..e56ff78251a 100644
> --- a/gdb/testsuite/lib/gdb.exp
> +++ b/gdb/testsuite/lib/gdb.exp
> @@ -5958,7 +5958,7 @@ proc test_class_help { command_class expected_initial_lines {list_of_commands {}
>          set l_list_of_commands {"List of commands\:.*[\r\n]+"}
>      }
>      set l_stock_body {
> -        "Type \"help\" followed by command name for full documentation\.[\r\n]+"
> +        "Type \"help\" followed by the appropriate command name for full documentation\.[\r\n]+"
>      }
>      set l_entire_body [concat $expected_initial_lines $l_list_of_commands \
>  		       $l_stock_body $help_list_trailer]
> @@ -5995,7 +5995,7 @@ proc test_prefix_command_help { command_list expected_initial_lines args } {
>      # be expanded in this list.
>      set l_stock_body [list\
>           "List of $full_command subcommands\:.*\[\r\n\]+"\
> -         "Type \"help $full_command\" followed by $full_command subcommand name for full documentation\.\[\r\n\]+"]
> +         "Type \"help $full_command\" followed by the appropriate command name for full documentation\.\[\r\n\]+"]
>      set l_entire_body [concat $expected_initial_lines $l_stock_body $help_list_trailer]
>      if {[llength $args]>0} {
>          help_test_raw "help ${command}" $l_entire_body [lindex $args 0]



More information about the Gdb-patches mailing list