[PATCH 3 of 5] show: standarize abort output with help output
Ryan McElroy
rm at fb.com
Thu Apr 13 10:17:28 UTC 2017
On 4/12/17 4:29 PM, Yuya Nishihara wrote:
> On Wed, 12 Apr 2017 12:35:22 +0100, Ryan McElroy wrote:
>> On 4/11/17 2:01 PM, Yuya Nishihara wrote:
>>> On Mon, 10 Apr 2017 02:41:05 -0700, Ryan McElroy wrote:
<snip>
>>>> show: standarize abort output with help output
<snip>
>>>> Available views:
>>>>
>>>> - bookmarks bookmarks and their associated changeset
>>>> + bookmarks -- bookmarks and their associated changeset
>>> Perhaps the original version derives from "hg help", which seems more
>>> standard.
>> So to be clear we're okay with the divergent output here? It bothers me
>> since both are sharing the same "source of truth" (the docblocks), but I
>> can get over it.
> I prefer not having the divergent output, but the original output with no
> dash seems more common.
>
> Perhaps we wouldn't want to modify docstring by registrar. The comment says
> "consider using formatter" so we'll need (name, doc) pair not "name doc"
> string, something like this:
It looks like Greg just sent out some patches cleaning up the output a
bit. I'll wait to see discussion on those before I proceed in any
particular direction here.
>
> @@ -36,8 +36,8 @@ command = cmdutil.command(cmdtable)
> class showcmdfunc(registrar._funcregistrarbase):
> """Register a function to be invoked for an `hg show <thing>`."""
>
> - # Used by _formatdoc().
> - _docformat = '%s -- %s'
> + def _formatdoc(self, decl, doc):
> + return doc
>
> def _extrasetup(self, name, func, fmtopic=None):
> """Called with decorator arguments to register a show view.
> @@ -87,7 +87,8 @@ def show(ui, repo, view=None, template=N
> ui.write('\n')
>
> for name, func in sorted(views.items()):
> - ui.write(('%s\n') % func.__doc__)
> + # this will be fm.write() ?
> + ui.write((' %s %s\n') % (name, func.__doc__))
>
> ui.write('\n')
> raise error.Abort(_('no view requested'),
More information about the Mercurial-devel
mailing list