summaryrefslogtreecommitdiff
path: root/src/mailman/commands/cli_help.py
diff options
context:
space:
mode:
authorBarry Warsaw2017-07-22 03:02:06 +0000
committerBarry Warsaw2017-07-22 03:02:06 +0000
commit02826321d0430d7ffc1f674eeff4221941689ef7 (patch)
tree1a8e56dff0eab71e58e5fc9ecc5f3c614d7edca7 /src/mailman/commands/cli_help.py
parentf54c045519300f6f70947d1114f46c2b8ae0d368 (diff)
parentf00b94f18e1d82d1488cbcee6053f03423bc2f49 (diff)
downloadmailman-02826321d0430d7ffc1f674eeff4221941689ef7.tar.gz
mailman-02826321d0430d7ffc1f674eeff4221941689ef7.tar.zst
mailman-02826321d0430d7ffc1f674eeff4221941689ef7.zip
Diffstat (limited to 'src/mailman/commands/cli_help.py')
-rw-r--r--src/mailman/commands/cli_help.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/mailman/commands/cli_help.py b/src/mailman/commands/cli_help.py
index 016fc1e23..af0108346 100644
--- a/src/mailman/commands/cli_help.py
+++ b/src/mailman/commands/cli_help.py
@@ -17,23 +17,27 @@
"""The 'help' subcommand."""
+import click
+
+from mailman.core.i18n import _
from mailman.interfaces.command import ICLISubCommand
+from mailman.utilities.options import I18nCommand
from public import public
from zope.interface import implementer
+@click.command(
+ cls=I18nCommand,
+ help=_('Show this help message and exit.'))
+@click.pass_context
+# https://github.com/pallets/click/issues/832
+def help(ctx): # pragma: nocover
+ click.echo(ctx.parent.get_help(), color=ctx.color)
+ ctx.exit()
+
+
@public
@implementer(ICLISubCommand)
class Help:
- # Lowercase, to match argparse's default --help text.
- """Show this help message and exit."""
-
name = 'help'
-
- def add(self, parser, command_parser):
- """See `ICLISubCommand`."""
- self.parser = parser
-
- def process(self, args):
- """See `ICLISubCommand`."""
- self.parser.print_help()
+ command = help