Updated ddrescue-tui-menu
This commit is contained in:
parent
5664765f6e
commit
25bacb9892
1 changed files with 44 additions and 44 deletions
|
|
@ -13,51 +13,51 @@ from functions.hw_diags import *
|
||||||
init_global_vars()
|
init_global_vars()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
try:
|
||||||
|
# Prep
|
||||||
|
clear_screen()
|
||||||
|
args = list(sys.argv)
|
||||||
|
run_mode = ''
|
||||||
|
source_path = None
|
||||||
|
dest_path = None
|
||||||
|
|
||||||
|
# Parse args
|
||||||
try:
|
try:
|
||||||
# Prep
|
script_name = os.path.basename(args.pop(0))
|
||||||
clear_screen()
|
run_mode = str(args.pop(0)).lower()
|
||||||
args = list(sys.argv)
|
source_path = args.pop(0)
|
||||||
run_mode = ''
|
dest_path = args.pop(0)
|
||||||
source_path = None
|
except IndexError:
|
||||||
dest_path = None
|
# We'll set the missing paths later
|
||||||
|
pass
|
||||||
|
|
||||||
# Parse args
|
# Show usage
|
||||||
try:
|
if re.search(r'-+(h|help)', str(sys.argv), re.IGNORECASE):
|
||||||
script_name = os.path.basename(args.pop(0))
|
show_usage(script_name)
|
||||||
run_mode = str(args.pop(0)).lower()
|
exit_script()
|
||||||
source_path = args.pop(0)
|
|
||||||
dest_path = args.pop(0)
|
|
||||||
except IndexError:
|
|
||||||
# We'll set the missing paths later
|
|
||||||
pass
|
|
||||||
|
|
||||||
# Show usage
|
# Start cloning/imaging
|
||||||
if re.search(r'-+(h|help)', str(sys.argv), re.IGNORECASE):
|
if run_mode in ('clone', 'image'):
|
||||||
show_usage(script_name)
|
menu_ddrescue(source_path, dest_path, run_mode)
|
||||||
exit_script()
|
else:
|
||||||
|
if not re.search(r'^-*(h|help\?)', run_mode, re.IGNORECASE):
|
||||||
|
print_error('Invalid mode.')
|
||||||
|
|
||||||
# Start cloning/imaging
|
# Done
|
||||||
if run_mode in ('clone', 'image'):
|
print_standard('\nDone.')
|
||||||
menu_ddrescue(source_path, dest_path, run_mode)
|
pause("Press Enter to exit...")
|
||||||
else:
|
exit_script()
|
||||||
if not re.search(r'^-*(h|help\?)', run_mode, re.IGNORECASE):
|
except GenericAbort:
|
||||||
print_error('Invalid mode.')
|
abort()
|
||||||
|
except GenericError as ge:
|
||||||
|
msg = 'Generic Error'
|
||||||
|
if str(ge):
|
||||||
|
msg = str(ge)
|
||||||
|
print_error(msg)
|
||||||
|
abort()
|
||||||
|
except SystemExit:
|
||||||
|
pass
|
||||||
|
except:
|
||||||
|
major_exception()
|
||||||
|
|
||||||
# Done
|
# vim: sts=2 sw=2 ts=2
|
||||||
print_standard('\nDone.')
|
|
||||||
pause("Press Enter to exit...")
|
|
||||||
exit_script()
|
|
||||||
except GenericAbort:
|
|
||||||
abort()
|
|
||||||
except GenericError as ge:
|
|
||||||
msg = 'Generic Error'
|
|
||||||
if str(ge):
|
|
||||||
msg = str(ge)
|
|
||||||
print_error(msg)
|
|
||||||
abort()
|
|
||||||
except SystemExit:
|
|
||||||
pass
|
|
||||||
except:
|
|
||||||
major_exception()
|
|
||||||
|
|
||||||
# vim: sts=4 sw=4 ts=4
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue