learn --delete-folder CLI option

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht
2016-07-08 21:23:27 +02:00
parent bb8e03bced
commit 2e81331a3c
4 changed files with 57 additions and 7 deletions

View File

@ -183,6 +183,21 @@ class Account(CustomConfig.ConfigHelperMixin):
self.ui.serverdiagnostics(local_repo, 'Local')
#self.ui.serverdiagnostics(statusrepos, 'Status')
def deletefolder(self, foldername):
remote_repo = Repository(self, 'remote')
try:
if self.dryrun:
self.ui.info("would try to remove '%s' on remote of '%s' "
"account"% (foldername, self))
else:
remote_repo.deletefolder(foldername)
self.ui.info("Folder '%s' deleted."% foldername)
return 0
except Exception as e:
self.ui.error(e)
return 1
class SyncableAccount(Account):
"""A syncable email account connecting 2 repositories.