From 9cb2d844baf1ec47bed25fd48e5762ab641b5498 Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Sun, 9 Aug 2009 10:49:35 -0400 Subject: A start on the 'mailman' subcommand layout, with the help of argparse. Right now the only subcommand is 'lists' which displays all mailing lists like the old bin/list_lists command did (which is now removed). Remove bin/version since 'bin/mailman --version' does this for us. Simplify the calculation of the bin scripts; there will be many fewer of them. Extend i18n to use a class based structure. By default, all i18n strings are dedented after translation and substitution, which improves command line help. The class structure allows for overriding this behavior. --- src/mailman/interfaces/command.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/mailman/interfaces/command.py') diff --git a/src/mailman/interfaces/command.py b/src/mailman/interfaces/command.py index 9995b80a9..14e7f9dd6 100644 --- a/src/mailman/interfaces/command.py +++ b/src/mailman/interfaces/command.py @@ -22,6 +22,7 @@ from __future__ import absolute_import, unicode_literals __metaclass__ = type __all__ = [ 'ContinueProcessing', + 'ICLISubCommand', 'IEmailCommand', 'IEmailResults', ] @@ -69,5 +70,19 @@ class IEmailCommand(Interface): -class IBinCommand(Interface): - """A command line (i.e. bin) command.""" +class ICLISubCommand(Interface): + """A command line interface subcommand.""" + + def add(subparser): + """Add the subcommand to the subparser. + + :param subparser: The argument subparser. + :type subparser: `argparse.ArgumentParser` + """ + + def process(args): + """Process the subcommand. + + :param args: The namespace, as passed in by argparse. + :type args: `argparse.Namespace` + """ -- cgit v1.2.3-70-g09d2