summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrien Sohier2015-12-01 19:14:40 +0100
committerAdrien Sohier2015-12-01 19:14:40 +0100
commit420fcb58c970419003737862178fac52f3fb3098 (patch)
treef07e2584baf773feac1ce449dba09e65d3240dec
parent90ebc1a88410fe3534f18fca0614564d12327514 (diff)
downloadaur-420fcb58c970419003737862178fac52f3fb3098.tar.gz
Added 'empty' operation
-rw-r--r--.SRCINFO2
-rw-r--r--PKGBUILD2
-rwxr-xr-xTrash.py12
3 files changed, 12 insertions, 4 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 15d5914c9cfa..a90d17100812 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = trash-py
pkgdesc = A cli trash in python 3
- pkgver = 1.0
+ pkgver = 1.1
pkgrel = 1
url = http://www.art-software.fr
arch = any
diff --git a/PKGBUILD b/PKGBUILD
index ed62d5d45a6a..1a4ce8a3d5c9 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,7 +1,7 @@
# Maintainer: Adrien Sohier <adrien.sohier@art-software.fr>
pkgname=trash-py
-pkgver=1.0
+pkgver=1.1
pkgrel=1
pkgdesc='A cli trash in python 3'
arch=('any')
diff --git a/Trash.py b/Trash.py
index 54b857e3d958..abf5c8ac8a03 100755
--- a/Trash.py
+++ b/Trash.py
@@ -1,6 +1,5 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
-# vim: foldlevel=0
from math import log
from os import environ, listdir, mkdir, stat, unlink
@@ -91,6 +90,11 @@ def restoreItems(ids):
unlink(pathDir+"/{itemId}".format(itemId=item))
print(_("Restored [{itemId}] {itemPath}").format(itemId=item, itemPath=path))
+def emptyTrash():
+ call(['rm', '-r', dataDir])
+ call(['rm', '-r', pathDir])
+ _checkTrashDir_
+
def orderIds():
notFound = 0
for num, item in enumerate([int(i) for i in listdir(pathDir)]):
@@ -113,7 +117,7 @@ def orderIds():
def showHelp():
print(basename(argv[0])+" [put <path [path [...]]> | list | drop <id [id [...]]> | restore <id [id [...]]> | gc]")
- print(_("\n- put:\t\tPut items to trash\n- list:\t\tList trashed items with their id\n- drop:\t\tDrop items from the trash\n- restore:\tRestore items from the trash to their original path\n- gc:\t\tReorder items"))
+ print(_("\n- put:\t\tPut items to trash\n- list:\t\tList trashed items with their id\n- drop:\t\tDrop items from the trash\n- empty:\tEmpty the trash.\n- restore:\tRestore items from the trash to their original path\n- gc:\t\tReorder items"))
##### Useful stuff #####
def _checkTrashDir_():
@@ -145,6 +149,10 @@ if __name__ == "__main__":
while len(args) > 0:
arg = args[0]
args = args[1:]
+
+ if arg == "empty":
+ emptyTrash()
+ break
if arg == "put":
putToTrash(args)