Commit 1dddebc5 authored by Barry Warsaw's avatar Barry Warsaw

bin/mailman help as an alias for bin/mailman --help

parent df000679
......@@ -63,7 +63,7 @@ def main():
for command_class in find_components('mailman.commands', ICLISubCommand):
command = command_class()
verifyObject(ICLISubCommand, command)
command.add(subparser)
command.add(parser, subparser)
args = parser.parse_args()
if len(args.__dict__) == 0:
# No arguments or subcommands were given.
......
# Copyright (C) 2009 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
# GNU Mailman is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# GNU Mailman. If not, see <http://www.gnu.org/licenses/>.
"""The 'help' subcommand."""
from __future__ import absolute_import, unicode_literals
__metaclass__ = type
__all__ = [
'Help',
]
from zope.interface import implements
from mailman.interfaces.command import ICLISubCommand
class Help:
"""The `help` subcommand."""
implements(ICLISubCommand)
def add(self, parser, subparser):
"""See `ICLISubCommand`."""
self.parser = parser
help_parser = subparser.add_parser(
'help', help=('show this help message and exit'))
help_parser.set_defaults(func=self.process)
def process(self, args):
"""See `ICLISubCommand`."""
self.parser.print_help()
......@@ -38,7 +38,7 @@ class Lists:
implements(ICLISubCommand)
def add(self, subparser):
def add(self, parser, subparser):
"""See `ICLISubCommand`."""
lists_parser = subparser.add_parser(
'lists', help=_('List all mailing lists'))
......
......@@ -73,9 +73,11 @@ class IEmailCommand(Interface):
class ICLISubCommand(Interface):
"""A command line interface subcommand."""
def add(subparser):
def add(parser, subparser):
"""Add the subcommand to the subparser.
:param parser: The argument parser.
:type parser: `argparse.ArgumentParser`
:param subparser: The argument subparser.
:type subparser: `argparse.ArgumentParser`
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment