diff options
| -rwxr-xr-x | mat | 11 |
1 files changed, 6 insertions, 5 deletions
| @@ -114,14 +114,15 @@ 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 = create_arg_parser() | 117 | argparser = create_arg_parser() |
| 118 | args = argparser.parse_args() | ||
| 118 | 119 | ||
| 119 | if len(sys.argv) < 2: # show help when the there is no argument provided | 120 | #show help if: neiter list nor file argument given; no argument at |
| 120 | args.print_help() | 121 | #all given or the list argument mixed with some other argument given |
| 122 | if (not args.list and not args.files) or (not len(sys.argv) > 1) or (args.list and len(sys.argv) > 2): | ||
| 123 | argparser.print_help() | ||
| 121 | sys.exit(2) | 124 | sys.exit(2) |
| 122 | 125 | ||
| 123 | args = args.parse_args() | ||
| 124 | |||
| 125 | # func receives the function corresponding to the options given as parameters | 126 | # func receives the function corresponding to the options given as parameters |
| 126 | if args.display: # only print metadatas | 127 | if args.display: # only print metadatas |
| 127 | func = list_meta | 128 | func = list_meta |
