# HG changeset patch # User Paul Boddie # Date 1488471492 -3600 # Node ID d68b59849a1d5f7a567b222134fac2447992d97f # Parent 04077d4d0478f5c2575131194358fbbb7436ba1c Detect and report unrecognised options. diff -r 04077d4d0478 -r d68b59849a1d lplc --- a/lplc Thu Mar 02 01:38:05 2017 +0100 +++ b/lplc Thu Mar 02 17:18:12 2017 +0100 @@ -183,6 +183,7 @@ verbose = False warnings = [] + unrecognised = [] filenames = [] outputs = [] @@ -204,6 +205,7 @@ elif arg.startswith("-o"): l, needed = start_arg_list(outputs, arg, "-o", 1) elif arg == ("-v", "--verbose"): verbose = True elif arg.startswith("-W"): l, needed = start_arg_list(warnings, arg, "-W", 1) + elif arg.startswith("-"): unrecognised.append(arg) else: l.append(arg) if needed: @@ -212,6 +214,12 @@ if needed == 0: l = filenames + # Report unrecognised options. + + if unrecognised: + print >>sys.stderr, "The following options were not recognised: %s" % ", ".join(unrecognised) + sys.exit(1) + # Add extra components to the module search path from the environment. if not ignore_env: