lib/opts: `OptionContext::parse` use `args` by default
authorAlexis Laferrière <alexis.laf@xymus.net>
Fri, 11 Dec 2015 23:24:56 +0000 (18:24 -0500)
committerAlexis Laferrière <alexis.laf@xymus.net>
Sat, 12 Dec 2015 16:30:58 +0000 (11:30 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/opts.nit

index 3d15652..da78780 100644 (file)
@@ -309,9 +309,10 @@ class OptionContext
                end
        end
 
-       # Parse and assign options everywhere in the argument list
-       fun parse(argv: Collection[String])
+       # Parse and assign options in `argv` or `args`
+       fun parse(argv: nullable Collection[String])
        do
+               if argv == null then argv = args
                var it = argv.iterator
                parse_intern(it)
        end