summaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
authorjvoisin2018-04-03 23:57:13 +0200
committerjvoisin2018-04-03 23:57:13 +0200
commitafeb3753a80bfd43ae1419b77b15d318c709708d (patch)
treeee90309e9c83dbd2154d0ce103b74e79b494ef76 /main.py
parent1d6559596df74c8af8d699a6709f7155400b9f98 (diff)
Improve the cli
- Implement the `-l` option - The help is now more awesome
Diffstat (limited to 'main.py')
-rw-r--r--main.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/main.py b/main.py
index c6b4b21..de623b2 100644
--- a/main.py
+++ b/main.py
@@ -44,21 +44,30 @@ def clean_meta(filename:str):
44 if not __check_file(filename, os.R_OK|os.W_OK): 44 if not __check_file(filename, os.R_OK|os.W_OK):
45 return 45 return
46 46
47 p, mtype = parser_factory.get_parser(f) 47 p, mtype = parser_factory.get_parser(filename)
48 if p is None: 48 if p is None:
49 print("[-] %s's format (%s) is not supported" % (filename, mtype)) 49 print("[-] %s's format (%s) is not supported" % (filename, mtype))
50 return 50 return
51 p.remove_all() 51 p.remove_all()
52 52
53def main(): 53def main():
54 args = create_arg_parser().parse_args() 54 arg_parser = create_arg_parser()
55 args = arg_parser.parse_args()
55 56
56 if args.show: 57 if args.show:
57 for f in args.files: 58 for f in args.files:
58 show_meta(f) 59 show_meta(f)
59 else: 60 elif args.list:
61 print('[+] Supported formats:')
62 for parser in parser_factory._get_parsers():
63 for mtype in parser.mimetypes:
64 extensions = ', '.join(mimetypes.guess_all_extensions(mtype))
65 print(' - %s (%s)' % (mtype, extensions))
66 elif args.files:
60 for f in args.files: 67 for f in args.files:
61 clean_meta(f) 68 clean_meta(f)
69 else:
70 arg_parser.print_help()
62 71
63 72
64if __name__ == '__main__': 73if __name__ == '__main__':