toolcontext: `process_options` require arguments.
authorJean Privat <jean@pryen.org>
Fri, 21 Mar 2014 02:06:29 +0000 (22:06 -0400)
committerJean Privat <jean@pryen.org>
Fri, 21 Mar 2014 13:22:43 +0000 (09:22 -0400)
Having it to access directly `sys.args` broke some isolation concerns.

This commit also updates all tools to avoid breakage.

Signed-off-by: Jean Privat <jean@pryen.org>

13 files changed:
src/debugger_commons.nit
src/metrics/metrics_base.nit
src/nitdbg_client.nit
src/nitdoc.nit
src/nitg.nit
src/nitlight.nit
src/nitls.nit
src/nitmetrics.nit
src/nitunit.nit
src/nitx.nit
src/test_markdown.nit
src/test_phase.nit
src/toolcontext.nit

index ad03be6..dcfebbd 100644 (file)
@@ -43,7 +43,7 @@ class InterpretCommons
                var opt_mixins = new OptionArray("Additionals module to min-in", "-m")
                toolcontext.option_context.add_option(opt_mixins)
                # We do not add other options, so process them now!
-               toolcontext.process_options
+               toolcontext.process_options(args)
                
                # We need a model to collect stufs
                var model = new Model
index 64770df..ee153de 100644 (file)
@@ -86,7 +86,7 @@ redef class ToolContext
                self.option_context.add_option(opt_nocolors)
        end
 
-       redef fun process_options
+       redef fun process_options(args)
        do
                super
                var val = self.opt_dir.value
index 489e1d7..3b06cf5 100644 (file)
@@ -105,7 +105,7 @@ end
 var toolcontext = new ToolContext
 toolcontext.tooldescription = "Usage: nitdbg_client [OPTION]...\nConnects to a nitdbg_server and controls it."
 toolcontext.accept_no_arguments = true
-toolcontext.process_options
+toolcontext.process_options(args)
 
 var debug: DebugClient
 
index 3ec48a9..57af655 100644 (file)
@@ -74,7 +74,7 @@ class NitdocContext
                toolcontext.option_context.add_option(opt_piwik_tracker)
                toolcontext.option_context.add_option(opt_piwik_site_id)
                toolcontext.tooldescription = "Usage: nitdoc [OPTION]... <file.nit>...\nGenerates HTML pages of API documentation from Nit source files."
-               toolcontext.process_options
+               toolcontext.process_options(args)
                self.arguments = toolcontext.option_context.rest
 
                self.process_options
index 9a6e69d..965be59 100644 (file)
@@ -39,7 +39,7 @@ toolcontext.option_context.add_option(opt_mixins)
 toolcontext.tooldescription = "Usage: nitg [OPTION]... file.nit\nCompiles Nit programs."
 
 # We do not add other options, so process them now!
-toolcontext.process_options
+toolcontext.process_options(args)
 
 # We need a model to collect stufs
 var model = new Model
index 7ead6b9..5f22329 100644 (file)
@@ -31,7 +31,7 @@ toolcontext.tooldescription = "Usage: nitlight [OPTION]... <file.nit>...\nGenera
 var model = new Model
 var modelbuilder = new ModelBuilder(model, toolcontext)
 
-toolcontext.process_options
+toolcontext.process_options(args)
 var args = toolcontext.option_context.rest
 
 var mmodules = modelbuilder.parse(args)
index c058219..3c24c20 100644 (file)
@@ -33,7 +33,7 @@ var opt_depends = new OptionBool("List dependencies of given modules", "-M", "--
 
 tc.option_context.add_option(opt_keep, opt_recursive, opt_tree, opt_source, opt_project, opt_depends)
 tc.tooldescription = "Usage: nitls [OPTION]... <file.nit|directory>...\nLists the projects and/or paths of Nit sources files."
-tc.process_options
+tc.process_options(args)
 
 var sum = opt_tree.value.to_i + opt_source.value.to_i + opt_project.value.to_i + opt_depends.value.to_i
 if sum > 1 then
index 01b3654..d3faeb0 100644 (file)
@@ -26,7 +26,7 @@ var toolcontext = new ToolContext
 toolcontext.tooldescription = "Usage: nitmetrics [OPTION]... <file.nit>...\mComputes various metrics on Nit programs."
 
 # We do not add other options, so process them now!
-toolcontext.process_options
+toolcontext.process_options(args)
 
 # Get arguments
 var arguments = toolcontext.option_context.rest
index 46c8254..4dceda0 100644 (file)
@@ -223,7 +223,7 @@ var toolcontext = new ToolContext
 toolcontext.option_context.add_option(toolcontext.opt_full, toolcontext.opt_output, toolcontext.opt_dir)
 toolcontext.tooldescription = "Usage: nitunit [OPTION]... <file.nit>...\nExecutes the unit tests from Nit source files."
 
-toolcontext.process_options
+toolcontext.process_options(args)
 var args = toolcontext.option_context.rest
 
 var model = new Model
index 7225571..d70c9e3 100644 (file)
@@ -868,7 +868,7 @@ end
 # Create a tool context to handle options and paths
 var toolcontext = new ToolContext
 toolcontext.tooldescription = "Usage: nitx [OPTION]... <file.nit> [query]\nDisplays specific pieces of API information from Nit source files."
-toolcontext.process_options
+toolcontext.process_options(args)
 
 # Here we launch the nit index
 var ni = new NitIndex(toolcontext)
index 24b48f7..d9c9060 100644 (file)
@@ -58,7 +58,7 @@ var opt_full = new OptionBool("Process also imported modules", "--full")
 toolcontext.option_context.add_option(opt_full)
 toolcontext.tooldescription = "Usage: test_markdown [OPTION]... <file.nit>...\nGenerates HTML of comments of documentation from Nit source files."
 
-toolcontext.process_options
+toolcontext.process_options(args)
 var args = toolcontext.option_context.rest
 
 var model = new Model
index 8594a5b..9898913 100644 (file)
@@ -25,7 +25,7 @@ var toolcontext = new ToolContext
 toolcontext.tooldescription = "Usage: [OPTION]... <file.nit>..."
 
 # We do not add other options, so process them now!
-toolcontext.process_options
+toolcontext.process_options(args)
 
 # Get arguments
 var arguments = toolcontext.option_context.rest
index 4e26321..85d7cd6 100644 (file)
@@ -197,7 +197,7 @@ class ToolContext
        end
 
        # Parse and process the options given on the command line
-       fun process_options
+       fun process_options(args: Sequence[String])
        do
                self.opt_warn.value = 1