WizardKit/.bin/Scripts/ddrescue-tui-menu
2Shirt 98b05c93bf
Moved menu_ddrescue() to ddrescue-tui-menu file
* Let's parse the sys.argv earlier in the process
2018-07-24 00:54:58 -06:00

52 lines
1.2 KiB
Python
Executable file

#!/bin/python3
#
## Wizard Kit: TUI for ddrescue cloning and imaging
import os
import sys
# Init
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
from functions.ddrescue import *
from functions.hw_diags import *
init_global_vars()
if __name__ == '__main__':
try:
# Prep
clear_screen()
args = list(sys.argv)
run_mode = ''
source_path = None
dest_path = None
# Parse args
try:
script_name = os.path.basename(args.pop(0))
run_mode = str(args.pop(0)).lower()
source_path = args.pop(0)
dest_path = args.pop(0)
except IndexError:
# We'll set the missing paths later
pass
# Show usage?
if run_mode in ('clone', 'image'):
menu_ddrescue(source_path, dest_path, run_mode)
else:
if not re.search(r'(^$|help|-h|\?)', run_mode, re.IGNORECASE):
print_error('Invalid mode.')
show_usage(script_name)
exit_script()
# Done
print_standard('\nDone.')
pause("Press Enter to exit...")
exit_script()
except SystemExit:
pass
except:
major_exception()
# vim: sts=4 sw=4 ts=4