mirror of
https://github.com/kevinveenbirkenbach/duplicate-file-handler.git
synced 2024-11-14 18:11:03 +01:00
show help if no parameters are passed
This commit is contained in:
parent
a54274b052
commit
c2566a355d
10
main.py
10
main.py
@ -65,16 +65,20 @@ def main(args):
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="Find and handle duplicate files.")
|
||||
parser.add_argument('directories', nargs='*', default=['./'], help="Directories to scan for duplicates.")
|
||||
parser.add_argument('directories', nargs='*', help="Directories to scan for duplicates.")
|
||||
parser.add_argument('--apply-to', nargs='*', help="Directories to apply modifications to.")
|
||||
parser.add_argument('--modification', choices=['delete', 'hardlink', 'symlink', 'show'], default='show', help="Modification to perform on duplicates.")
|
||||
parser.add_argument('--mode', choices=['act', 'preview', 'interactive'], default='preview', help="How to apply the modifications.")
|
||||
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if not args.directories:
|
||||
parser.print_help()
|
||||
parser.exit()
|
||||
|
||||
if args.apply_to and args.modification not in ['delete', 'hardlink', 'symlink']:
|
||||
parser.error("--apply-to requires --modification to be 'delete', 'hardlink', or 'symlink'.")
|
||||
if not args.apply_to and args.modification != 'show':
|
||||
parser.error("Without --apply-to only 'show' modification is allowed.")
|
||||
|
||||
|
||||
main(args)
|
||||
|
Loading…
Reference in New Issue
Block a user