------------------------------------------------------------
revno: 6764
committer: Barry Warsaw <[email protected]>
branch nick: 3.0
timestamp: Sun 2009-08-09 11:25:59 -0400
message:
  bin/mailman help as an alias for bin/mailman --help
added:
  src/mailman/commands/cli_help.py
modified:
  src/mailman/bin/mailman.py
  src/mailman/commands/cli_lists.py
  src/mailman/interfaces/command.py


--
lp:mailman
https://code.launchpad.net/~mailman-coders/mailman/3.0

Your team Mailman Checkins is subscribed to branch lp:mailman.
To unsubscribe from this branch go to 
https://code.launchpad.net/~mailman-coders/mailman/3.0/+edit-subscription.
=== modified file 'src/mailman/bin/mailman.py'
--- src/mailman/bin/mailman.py	2009-08-09 14:49:35 +0000
+++ src/mailman/bin/mailman.py	2009-08-09 15:25:59 +0000
@@ -63,7 +63,7 @@
     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.

=== added file 'src/mailman/commands/cli_help.py'
--- src/mailman/commands/cli_help.py	1970-01-01 00:00:00 +0000
+++ src/mailman/commands/cli_help.py	2009-08-09 15:25:59 +0000
@@ -0,0 +1,48 @@
+# 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()

=== modified file 'src/mailman/commands/cli_lists.py'
--- src/mailman/commands/cli_lists.py	2009-08-09 15:01:16 +0000
+++ src/mailman/commands/cli_lists.py	2009-08-09 15:25:59 +0000
@@ -38,7 +38,7 @@
 
     implements(ICLISubCommand)
 
-    def add(self, subparser):
+    def add(self, parser, subparser):
         """See `ICLISubCommand`."""
         lists_parser = subparser.add_parser(
             'lists', help=_('List all mailing lists'))

=== modified file 'src/mailman/interfaces/command.py'
--- src/mailman/interfaces/command.py	2009-08-09 14:49:35 +0000
+++ src/mailman/interfaces/command.py	2009-08-09 15:25:59 +0000
@@ -73,9 +73,11 @@
 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`
         """

_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to