src: transform all old writable in annotations
[nit.git] / src / toolcontext.nit
index 6aeda8d..dd1d2c1 100644 (file)
@@ -202,13 +202,8 @@ class ToolContext
        # Verbose level
        var verbose_level: Int = 0
 
-       # Bash completion behavior in command line
-       # see `BashCompletion`
-       var bash_completion: BashCompletion
-
        init
        do
-               bash_completion = new BashCompletion(self)
                option_context.add_option(opt_warn, opt_quiet, opt_stop_on_first_error, opt_no_color, opt_log, opt_log_dir, opt_help, opt_version, opt_set_dummy_tool, opt_verbose, opt_bash_completion)
        end
 
@@ -218,14 +213,14 @@ class ToolContext
        # A multi-line string is recommmended.
        #
        # eg. `"Usage: tool [OPTION]... [FILE]...\nDo some things."`
-       var tooldescription: String writable = "Usage: [OPTION]... [ARG]..."
+       var tooldescription: String = "Usage: [OPTION]... [ARG]..." is writable
 
        # Does `process_options` should accept an empty sequence of arguments.
        # ie. nothing except options.
        # Is `false` by default.
        #
        # If required, if should be set by the client before calling `process_options`
-       var accept_no_arguments writable = false
+       var accept_no_arguments = false is writable
 
        # print the full usage of the tool.
        # Is called by `process_option` on `--help`.
@@ -255,6 +250,7 @@ class ToolContext
                end
 
                if opt_bash_completion.value then
+                       var bash_completion = new BashCompletion(self)
                        bash_completion.write_to(sys.stdout)
                        exit 0
                end
@@ -304,7 +300,7 @@ class ToolContext
        end
 
        # The identified root directory of the Nit project
-       var nit_dir: nullable String
+       var nit_dir: nullable String = null
 
        private fun compute_nit_dir: nullable String
        do
@@ -343,8 +339,8 @@ end
 #      --help                 --only-metamodel       --source
 #      --ignore-visibility    --only-parse           --stop-on-first-error
 #
-# Generated file must be placed in system bash_completion directory `/etc/bash_completion.d/`
-# or in the user directory `~/.bash_completion`.
+# Generated file can be placed in system bash_completion directory `/etc/bash_completion.d/`
+# or source it in `~/.bash_completion`.
 class BashCompletion
        super Template