diff options
author | Britney Fransen <brfransen@gmail.com> | 2015-03-05 19:47:39 (GMT) |
---|---|---|
committer | Britney Fransen <brfransen@gmail.com> | 2015-03-05 19:47:39 (GMT) |
commit | 83d724ff9bfe884bc4ee7d65fbc3846082a3fcca (patch) | |
tree | 062b1c5b99a62a6dc46d8962c33d7ea09ec89eac /abs/core/LinHES-system/find_orphans.py | |
parent | d25a4fbd6a135c232c447dd17b0f15d7391cd40f (diff) | |
download | linhes_pkgbuild-83d724ff9bfe884bc4ee7d65fbc3846082a3fcca.zip linhes_pkgbuild-83d724ff9bfe884bc4ee7d65fbc3846082a3fcca.tar.gz linhes_pkgbuild-83d724ff9bfe884bc4ee7d65fbc3846082a3fcca.tar.bz2 |
LinHES-system: find_orphans.py: add quit option to list
Diffstat (limited to 'abs/core/LinHES-system/find_orphans.py')
-rw-r--r-- | abs/core/LinHES-system/find_orphans.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/abs/core/LinHES-system/find_orphans.py b/abs/core/LinHES-system/find_orphans.py index cdc03d4..c134e82 100644 --- a/abs/core/LinHES-system/find_orphans.py +++ b/abs/core/LinHES-system/find_orphans.py @@ -12,7 +12,7 @@ def human_size(s): while s > 1000: s /= 1000 o += 1 - return str(round(s,1))+('B ','KB','MB','GB')[o] + return str(round(s,1))+('B ','KB','MB','GB','TB')[o] class File( str ): def __new__(self, host, group, path, name, size): @@ -120,7 +120,7 @@ def populate(host=None): def delete_recs(recs): printrecs('The following recordings will be deleted', recs) - print 'Are you sure you want to continue?' + print 'Are you sure you want to continue? (yes/no)' try: res = raw_input('> ') while True: @@ -144,7 +144,7 @@ def delete_recs(recs): def delete_files(files): printfiles('The following files will be deleted', files) - print 'Are you sure you want to continue?' + print 'Are you sure you want to continue? (yes/no)' try: res = raw_input('> ') while True: @@ -190,10 +190,15 @@ def main(host=None): if len(unfiltered): opts.append(['Delete other files', delete_files, unfiltered]) opts.append(['Refresh list', None, None]) - print 'Please select from the following' + print 'Please select from the following:' for i, opt in enumerate(opts): - print ' {0}. {1}'.format(i+1, opt[0]) + if opt[0] == "Refresh list": + print ' R. {1}'.format(i+1, opt[0]) + refreshNum=i+1 + else: + print ' {0}. {1}'.format(i+1, opt[0]) + print ' Q. Quit' try: inner = True res = raw_input('> ') @@ -201,10 +206,15 @@ def main(host=None): try: res = int(res) except: - res = raw_input('input number. ctrl-c to exit > ') + if res == "Q" or res == "q": + sys.exit(0) + elif res == "R" or res == "r": + res = refreshNum + else: + res = raw_input('Invalid selection > ') continue if (res <= 0) or (res > len(opts)): - res = raw_input('input number within range > ') + res = raw_input('Invalid selection > ') continue break opt = opts[res-1] |