Enable help flags for aliases

This commit is contained in:
2Shirt 2018-08-15 20:35:09 -07:00
parent 1a983344c2
commit e0a695a673
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 11 additions and 4 deletions

View file

@ -31,13 +31,17 @@ if __name__ == '__main__':
# We'll set the missing paths later
pass
# Show usage?
# Show usage
if re.search(r'-*(h|help|\?)', str(sys.argv), re.IGNORECASE):
show_usage(script_name)
exit_script()
# Start cloning/imaging
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):
if not re.search(r'^-*(h|help\?)', run_mode, re.IGNORECASE):
print_error('Invalid mode.')
show_usage(script_name)
# Done
print_standard('\nDone.')

View file

@ -118,7 +118,7 @@ class BlockPair():
def load_map_data(self):
"""Load data from map file and set progress."""
map_data = read_map_file(self.map_path)
self.rescued = map_data['rescued'] * self.size
self.rescued = map_data['rescued'] * self.size / 100
if map_data['full recovery']:
self.pass_done = [True, True, True]
self.rescued = self.size
@ -132,6 +132,9 @@ class BlockPair():
elif map_data['non-scraped'] > 0:
self.pass_done = [True, True, False]
self.status = ['Skipped', 'Skipped', 'Pending']
else:
self.pass_done = [True, True, True]
self.status = ['Skipped', 'Skipped', 'Skipped']
def self_check(self):
"""Self check to abort on bad dest/map combinations."""