diff options
| -rwxr-xr-x | mat | 14 |
1 files changed, 10 insertions, 4 deletions
| @@ -11,8 +11,8 @@ from libmat import mat | |||
| 11 | from libmat import archive | 11 | from libmat import archive |
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | def parse(): | 14 | def create_arg_parser(): |
| 15 | """ Get, and parse options passed to the program | 15 | """ Get options passed to the program |
| 16 | """ | 16 | """ |
| 17 | parser = argparse.ArgumentParser(description='Metadata anonymisation toolkit') | 17 | parser = argparse.ArgumentParser(description='Metadata anonymisation toolkit') |
| 18 | parser.add_argument('files', nargs='*') | 18 | parser.add_argument('files', nargs='*') |
| @@ -35,7 +35,7 @@ def parse(): | |||
| 35 | info.add_argument('-v', '--version', action='version', | 35 | info.add_argument('-v', '--version', action='version', |
| 36 | version='MAT %s' % mat.__version__) | 36 | version='MAT %s' % mat.__version__) |
| 37 | 37 | ||
| 38 | return parser.parse_args() | 38 | return parser |
| 39 | 39 | ||
| 40 | 40 | ||
| 41 | def list_meta(class_file, filename, add2archive): | 41 | def list_meta(class_file, filename, add2archive): |
| @@ -114,7 +114,13 @@ def list_supported(): | |||
| 114 | 114 | ||
| 115 | def main(): | 115 | def main(): |
| 116 | """ Main function: get args and launch the appropriate function """ | 116 | """ Main function: get args and launch the appropriate function """ |
| 117 | args = parse() | 117 | args = create_arg_parser() |
| 118 | |||
| 119 | if len(sys.argv) < 2: # show help when the there is no argument provided | ||
| 120 | args.print_help() | ||
| 121 | sys.exit(2) | ||
| 122 | |||
| 123 | args = args.parse_args() | ||
| 118 | 124 | ||
| 119 | # func receives the function corresponding to the options given as parameters | 125 | # func receives the function corresponding to the options given as parameters |
| 120 | if args.display: # only print metadatas | 126 | if args.display: # only print metadatas |
