[PATCH V2] help: hide command line options marked as "advanced"
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Tue Nov 1 23:41:03 UTC 2016
On 11/01/2016 04:08 PM, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark at fb.com>
> # Date 1478011845 0
> # Tue Nov 01 14:50:45 2016 +0000
> # Node ID 058074cf24ce30ee0bc6d6a4d91fbe35631f8e8e
> # Parent 264f00b3e5f045ac5b58d79e2a3976585f4e7739
> # Available At https://bitbucket.org/quark-zju/hg-draft
> # hg pull https://bitbucket.org/quark-zju/hg-draft -r 058074cf24ce
> help: hide command line options marked as "advanced"
>
> Previously, we have keywords like "(DEPRECATED)" and "(EXPERIMENTAL)" to
> hide command line options in non-verbose help output.
>
> However, sometimes an option is neither deprecated nor experimental. It's
> well-tested and working, but just not designed to average users. This patch
> adds a keyword "(ADVANCED)" to fit in such use cases.
>
> Thanks rom1dep for the suggestion of the word "advanced".
Do we have any candidate for this in core ?
We probably need to hint the fact we have more to show here. Having
verbose section display a note about it, we should have the same here.
> diff --git a/mercurial/help.py b/mercurial/help.py
> --- a/mercurial/help.py
> +++ b/mercurial/help.py
> @@ -34,12 +34,15 @@ from .hgweb import (
> )
>
> -_exclkeywords = [
> +_exclkeywords = set([
> + "(ADVANCED)",
> "(DEPRECATED)",
> "(EXPERIMENTAL)",
> + # i18n: "(ADVANCED)" is a keyword, must be translated consistently
> + _("(ADVANCED)"),
> # i18n: "(DEPRECATED)" is a keyword, must be translated consistently
> _("(DEPRECATED)"),
> # i18n: "(EXPERIMENTAL)" is a keyword, must be translated consistently
> _("(EXPERIMENTAL)"),
> - ]
> + ])
>
> def listexts(header, exts, indent=1, showdeprecated=False):
> diff --git a/tests/test-help.t b/tests/test-help.t
> --- a/tests/test-help.t
> +++ b/tests/test-help.t
> @@ -684,4 +684,5 @@ this is a section and erroring out weird
> > 'hg nohelp',
> > norepo=True)
> + > @command('debugoptADV', [('', 'aopt', None, 'option is (ADVANCED)')])
> > @command('debugoptDEP', [('', 'dopt', None, 'option is (DEPRECATED)')])
> > @command('debugoptEXP', [('', 'eopt', None, 'option is (EXPERIMENTAL)')])
> @@ -897,4 +898,5 @@ Test list of internal help commands
> debugobsolete
> create arbitrary obsolete marker
> + debugoptADV (no help text available)
> debugoptDEP (no help text available)
> debugoptEXP (no help text available)
> @@ -1108,5 +1110,13 @@ Test list of commands with command with
>
>
> -test deprecated and experimental options are hidden in command help
> +test advanced, deprecated and experimental options are hidden in command help
> + $ hg help debugoptADV
> + hg debugoptADV
> +
> + (no help text available)
> +
> + options:
> +
> + (some details hidden, use --verbose to show complete help)
> $ hg help debugoptDEP
> hg debugoptDEP
> @@ -1127,5 +1137,7 @@ test deprecated and experimental options
> (some details hidden, use --verbose to show complete help)
>
> -test deprecated and experimental options is shown with -v
> +test advanced, deprecated and experimental options are shown with -v
> + $ hg help -v debugoptADV | grep aopt
> + --aopt option is (ADVANCED)
> $ hg help -v debugoptDEP | grep dopt
> --dopt option is (DEPRECATED)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
--
Pierre-Yves David
More information about the Mercurial-devel
mailing list