diff options
| author | Barry Warsaw | 2017-07-22 03:02:06 +0000 |
|---|---|---|
| committer | Barry Warsaw | 2017-07-22 03:02:06 +0000 |
| commit | 02826321d0430d7ffc1f674eeff4221941689ef7 (patch) | |
| tree | 1a8e56dff0eab71e58e5fc9ecc5f3c614d7edca7 /src/mailman/commands/cli_aliases.py | |
| parent | f54c045519300f6f70947d1114f46c2b8ae0d368 (diff) | |
| parent | f00b94f18e1d82d1488cbcee6053f03423bc2f49 (diff) | |
| download | mailman-02826321d0430d7ffc1f674eeff4221941689ef7.tar.gz mailman-02826321d0430d7ffc1f674eeff4221941689ef7.tar.zst mailman-02826321d0430d7ffc1f674eeff4221941689ef7.zip | |
Diffstat (limited to 'src/mailman/commands/cli_aliases.py')
| -rw-r--r-- | src/mailman/commands/cli_aliases.py | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/mailman/commands/cli_aliases.py b/src/mailman/commands/cli_aliases.py index 3ac46a1d9..4ce41eedd 100644 --- a/src/mailman/commands/cli_aliases.py +++ b/src/mailman/commands/cli_aliases.py @@ -17,30 +17,31 @@ """Generate Mailman alias files for your MTA.""" +import click + from mailman.config import config from mailman.core.i18n import _ from mailman.interfaces.command import ICLISubCommand from mailman.utilities.modules import call_name +from mailman.utilities.options import I18nCommand from public import public from zope.interface import implementer +@click.command( + cls=I18nCommand, + help=_('Regenerate the aliases appropriate for your MTA.')) +@click.option( + '--directory', '-d', + type=click.Path(exists=True, file_okay=False, resolve_path=True, + writable=True), + help=_('An alternative directory to output the various MTA files to.')) +def aliases(directory): + call_name(config.mta.incoming).regenerate(directory) + + @public @implementer(ICLISubCommand) class Aliases: - """Regenerate the aliases appropriate for your MTA.""" - name = 'aliases' - - def add(self, parser, command_parser): - """See `ICLISubCommand`.""" - self.parser = parser - command_parser.add_argument( - '-d', '--directory', - action='store', help=_("""\ - An alternative directory to output the various MTA files to.""")) - - def process(self, args): - """See `ICLISubCommand`.""" - # Call the MTA-specific regeneration method. - call_name(config.mta.incoming).regenerate(args.directory) + command = aliases |
