diff options
| author | Thibaut Horel <thibaut.horel@gmail.com> | 2014-08-17 20:27:44 -0400 |
|---|---|---|
| committer | Thibaut Horel <thibaut.horel@gmail.com> | 2014-08-17 20:27:44 -0400 |
| commit | cb2e7c09daefafad97618763f43c991baf8e9365 (patch) | |
| tree | 339bec874ce6b0b6efec33943b93325db63de153 /attach.py | |
| download | mutt-helpers-cb2e7c09daefafad97618763f43c991baf8e9365.tar.gz | |
Initial commit
Diffstat (limited to 'attach.py')
| -rwxr-xr-x | attach.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/attach.py b/attach.py new file mode 100755 index 0000000..5750537 --- /dev/null +++ b/attach.py @@ -0,0 +1,18 @@ +#! /usr/bin/python2 +from glob import glob +from os.path import expanduser, join, basename +from os import remove, devnull +from shutil import copy +from sys import argv +from subprocess import Popen, STDOUT + +tmp_dir = expanduser(join("~", ".mutt", "temp", "attachments")) + +for f in glob(join(tmp_dir, "*")): + remove(f) + +basename = basename(argv[1]) +copy(argv[1], tmp_dir) +Popen(["xdg-open", join(tmp_dir, basename)], + stderr=STDOUT, + stdout=open(devnull, "wb")) |
