summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2014-11-17 09:46:18 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2014-11-17 09:46:18 +0100
commitb5483a0653ecbdbcbd29a06deb75b47700a09fdd (patch)
tree437525713e1b176781339e8580965bc5d154ff85
parent33789dbe2b3c95d291218953e88e9d7c82ba05c3 (diff)
downloadpykolab-b5483a0653ecbdbcbd29a06deb75b47700a09fdd.tar.gz
Allow multiple arguments to be specified
-rw-r--r--pykolab/cli/cmd_delete_mailbox.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/pykolab/cli/cmd_delete_mailbox.py b/pykolab/cli/cmd_delete_mailbox.py
index ea64abc..9a7e1b1 100644
--- a/pykolab/cli/cmd_delete_mailbox.py
+++ b/pykolab/cli/cmd_delete_mailbox.py
@@ -40,9 +40,7 @@ def execute(*args, **kw):
Delete mailbox
"""
- try:
- delete_folder = conf.cli_args.pop(0)
- except IndexError, e:
+ if len(conf.cli_args) < 1:
print >> sys.stderr, _("No mailbox specified")
sys.exit(1)
@@ -50,10 +48,18 @@ def execute(*args, **kw):
imap.connect()
- delete_folders = imap.list_folders(delete_folder)
+ delete_folders = []
+ while len(conf.cli_args) > 0:
+ folder = conf.cli_args.pop(0)
+ folders = imap.list_folders(folder)
+
+ if len(folders) < 1:
+ print >> sys.stderr, _("No such folder(s): %s") % (folder)
+
+ delete_folders.extend(folders)
if len(delete_folders) == 0:
- print >> sys.stderr, _("No such folder(s)")
+ print >> sys.stderr, _("No folders to delete.")
sys.exit(1)
for delete_folder in delete_folders: