fix various small things

This commit is contained in:
Andreas Zweili 2016-12-16 10:05:32 +01:00
parent 366dff3ee7
commit bbd9d9bb32
1 changed files with 24 additions and 24 deletions

View File

@ -8,6 +8,7 @@ import curses
int_vars = interface_variables
def get_param(prompt_string):
screen = curses.initscr()
screen.clear()
screen.border(0)
screen.addstr(2, 2, prompt_string)
@ -35,21 +36,21 @@ def list_archives():
less_output.wait()
def show_info():
archive_name = get_param("Please enter the archive name: ")
curses.endwin()
prompt_archive_name()
os.system('clear')
p = subprocess.Popen(['borg', 'info', '::' + int_vars.archive_name])
p = subprocess.Popen(['borg', 'info', '::' + archive_name])
p.wait()
print()
pause()
def mount_archive():
archive_name = get_param("Please enter the archive name: ")
curses.endwin()
prompt_archive_name()
int_vars.mount_point = "/tmp/" + int_vars.archive_name
int_vars.mount_point = os.path.join('/tmp', archive_name)
if not os.path.exists(int_vars.mount_point):
os.makedirs(int_vars.mount_point)
p = subprocess.Popen(['borg', 'mount', '::' + int_vars.archive_name,
p = subprocess.Popen(['borg', 'mount', '::' + archive_name,
int_vars.mount_point])
p.wait()
print()
@ -109,6 +110,7 @@ def exit():
curses.endwin()
if (not int_vars.mount_point):
print()
os.system('clear')
sys.exit(0)
else:
print()
@ -116,10 +118,8 @@ def exit():
print()
os.system('fusermount -u' + " " + int_vars.mount_point)
os.rmdir(int_vars.mount_point)
os.system('clear')
sys.exit(0)
def pause():
input("Press Enter to continue.")
def prompt_archive_name():
int_vars.archive_name = input("Please enter the archive name: ")