summaryrefslogtreecommitdiff
path: root/alot
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2011-12-20 10:44:42 +0000
committerPatrick Totzke <patricktotzke@gmail.com>2011-12-20 10:44:42 +0000
commit4369b464da69ab0af81823eb779c031a63d5e340 (patch)
treea47b78af8bc30d9c66c5e50463379e40fa0716dd /alot
parent88c03aa51bc945f708db32906d4e0940f7dbb90f (diff)
added --attach parameter to compose cmd
Diffstat (limited to 'alot')
-rw-r--r--alot/commands/globals.py11
-rwxr-xr-xalot/init.py1
2 files changed, 11 insertions, 1 deletions
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):