Commit 7983af23 authored by Muri Nicanor's avatar Muri Nicanor

refined argument exceptions

parent 65c6966c
......@@ -114,14 +114,15 @@ def list_supported():
def main():
""" Main function: get args and launch the appropriate function """
args = create_arg_parser()
argparser = create_arg_parser()
args = argparser.parse_args()
if len(sys.argv) < 2: # show help when the there is no argument provided
args.print_help()
#show help if: neiter list nor file argument given; no argument at
#all given or the list argument mixed with some other argument given
if (not args.list and not args.files) or (not len(sys.argv) > 1) or (args.list and len(sys.argv) > 2):
argparser.print_help()
sys.exit(2)
args = args.parse_args()
# func receives the function corresponding to the options given as parameters
if args.display: # only print metadatas
func = list_meta
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment