Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Philippe Waroquiers <philippe.waroquiers@skynet.be>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] Make first and last lines of 'command help documentation' consistent.
Date: Wed, 10 Jul 2019 17:02:00 -0000	[thread overview]
Message-ID: <874l3tg6vh.fsf@tromey.com> (raw)
In-Reply-To: <20190616195804.9427-1-philippe.waroquiers@skynet.be> (Philippe	Waroquiers's message of "Sun, 16 Jun 2019 21:58:04 +0200")

>>>>> "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:

Philippe> With this patch, the help docs now respect 2 invariants:
Philippe>   * The first line of a command help is terminated by a '.' character.
Philippe>   * The last character of a command help is not a newline character.

Thanks for doing this.  I'm in favor of the change, as I think it
improves the help experience and doesn't make anything worse.

Philippe> gdb/ChangeLog
Philippe> 2019-06-16  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

Philippe> 	* cli/cli-decode.h (print_doc_line): Add for_value_prefix argument.
Philippe> 	* cli/cli-decode.c (print_doc_line): Likewise.  It now prints
Philippe> 	the full first line, except when FOR_VALUE_PREFIX.  In this case,
Philippe> 	the trailing '.' is not output, and the first character is uppercased.
Philippe> 	(print_help_for_command): Update call to print_doc_line.
Philippe> 	(print_doc_of_command): Likewise.  Output a specific string
Philippe> 	when doc string ends with a line feed to allow the testsuite
Philippe> 	to detect the broken invariant.
Philippe> 	* cli/cli-setshow.c (deprecated_show_value_hack): Likewise.
Philippe> 	* cli/cli-option.c (append_indented_doc): Do not append newline.
Philippe> 	(build_help_option): Append newline after first appended_indented_doc
Philippe> 	only if a second call is done.
Philippe> 	(build_help): Append 2 new lines before each option, except the first
Philippe> 	one.
Philippe> 	* compile/compile.c (_initialize_compile): Add new lines after
Philippe> 	%OPTIONS%, when not at the end of the help.
Philippe> C	hange help doc or code

Little hiccup in the ChangeLog.

Philippe> +  /* Checks that the documentation does not help with a new line.
Philippe> +     If it does, output a special marker string that gdb.base/help.exp
Philippe> +     will detect.  */
Philippe> +  if (c->doc[strlen (c->doc) - 1] == '\n')
Philippe> +    fprintf_filtered (stream, "END_OF_LINE@END_OF_DOC %s%s\n",
Philippe> +		      prefix, c->name);

I think this can't be an assertion, because user commands could hit it,
and that seems too harsh; but could it be a unit test?  That might be
better than printing something magic, especially since IIUC the user can
end up seeing this stuff.

Philippe> -Usage: maintenance selftest [filter]\n\
Philippe> +Usage: maintenance selftest [FILTER]\n\

Thank you.

Philippe> +gdb_test_no_output \
Philippe> +    "|apropos .| grep -e '\[^\.\]$' -e '^END_OF_LINE@END_OF_DOC '" \
Philippe> +    "command help doc first line ends with a dot, doc does not end with eol"

I'm not sure we can rely on having grep in the test suite.  If you
switch the patch to a self-test, then this is moot; otherwise, is this
used elsewhere?  I think a different approach is to write to a log file
and then examine it with Tcl.  I believe some other tests do this.

Tom


  parent reply	other threads:[~2019-07-10 17:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-16 19:58 Philippe Waroquiers
2019-07-05 20:04 ` PING " Philippe Waroquiers
2019-07-10 17:02 ` Tom Tromey [this message]
2019-07-10 22:31   ` Philippe Waroquiers
2019-07-11 12:22     ` Tom Tromey
2019-07-11 12:53       ` Pedro Alves
2019-07-11 13:12         ` Tom Tromey
2019-07-11 15:49           ` Pedro Alves
2019-07-11 15:51             ` Pedro Alves
2019-07-11 15:58               ` Tom Tromey
2019-07-11 15:44   ` Pedro Alves
2019-07-11 13:49 ` Pedro Alves
2019-07-29 21:27   ` Philippe Waroquiers
2019-07-11 14:18 ` Pedro Alves
2019-07-11 15:39 ` Pedro Alves
2019-07-11 15:43 ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874l3tg6vh.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=philippe.waroquiers@skynet.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox