From 4369b464da69ab0af81823eb779c031a63d5e340 Mon Sep 17 00:00:00 2001 From: Patrick Totzke Date: Tue, 20 Dec 2011 10:44:42 +0000 Subject: added --attach parameter to compose cmd --- alot/commands/globals.py | 11 ++++++++++- alot/init.py | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'alot') diff --git a/alot/commands/globals.py b/alot/commands/globals.py index 46fbd6f0..4ead9c58 100644 --- a/alot/commands/globals.py +++ b/alot/commands/globals.py @@ -426,11 +426,12 @@ class HelpCommand(Command): (['--to'], {'nargs':'+', 'help':'recipients'}), (['--cc'], {'nargs':'+', 'help':'copy to'}), (['--bcc'], {'nargs':'+', 'help':'blind copy to'}), + (['--attach'], {'nargs':'+', 'help':'attach files'}), ]) class ComposeCommand(Command): """compose a new email""" def __init__(self, envelope=None, headers={}, template=None, - sender=u'', subject=u'', to=[], cc=[], bcc=[], + sender=u'', subject=u'', to=[], cc=[], bcc=[], attach=None, **kwargs): """ :param envelope: use existing envelope @@ -451,6 +452,8 @@ class ComposeCommand(Command): :type cc: str :param bcc: Bcc-header value :type bcc: str + :param attach: Path to files to be attached (globable) + :type attach: str """ Command.__init__(self, **kwargs) @@ -463,6 +466,7 @@ class ComposeCommand(Command): self.to = to self.cc = cc self.bcc = bcc + self.attach = attach @inlineCallbacks def apply(self, ui): @@ -559,6 +563,11 @@ class ComposeCommand(Command): ui.notify('canceled') return self.envelope.add('Subject', subject) + + if self.attach: + for a in self.attach: + self.envelope.attach(a) + cmd = commands.envelope.EditCommand(envelope=self.envelope) ui.apply_command(cmd) diff --git a/alot/init.py b/alot/init.py index 547f142a..0231ec03 100755 --- a/alot/init.py +++ b/alot/init.py @@ -29,6 +29,7 @@ class ComposeOptions(usage.Options): ['cc', '', None, 'copy to'], ['bcc', '', None, 'blind copy to'], ['template', '', None, 'path to template file'], + ['attach', '', None, 'files to attach'], ] def parseArgs(self, *args): -- cgit v1.2.3