lib/opts: fixes documentation warnings
authorAlexandre Terrasa <alexandre@moz-code.org>
Sat, 13 Dec 2014 21:00:30 +0000 (16:00 -0500)
committerAlexandre Terrasa <alexandre@moz-code.org>
Mon, 12 Jan 2015 08:18:07 +0000 (09:18 +0100)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

lib/opts.nit

index 8f2dc48..fa5ce15 100644 (file)
@@ -48,6 +48,9 @@ abstract class Option
                init_opt(help, default, names)
        end
 
+       # Init option `helptext`, `default_value` and `names`.
+       #
+       # Also set current `value` to `default`.
        fun init_opt(help: String, default: VALUE, names: nullable Array[String])
        do
                if names == null then
@@ -79,6 +82,7 @@ abstract class Option
                return text.to_s
        end
 
+       # Pretty print the default value.
        fun pretty_default: String
        do
                var dv = default_value
@@ -97,6 +101,7 @@ end
 class OptionText
        super Option
 
+       # Init a new OptionText with `text`.
        init(text: String) is old_style_init do super(text, null, null)
 
        redef fun pretty(off) do return to_s
@@ -109,6 +114,7 @@ class OptionBool
        super Option
        redef type VALUE: Bool
 
+       # Init a new OptionBool with a `help` message and `names`.
        init(help: String, names: String...) is old_style_init do super(help, false, names)
 
        redef fun read_param(it)
@@ -123,6 +129,7 @@ class OptionCount
        super Option
        redef type VALUE: Int
 
+       # Init a new OptionCount with a `help` message and `names`.
        init(help: String, names: String...) is old_style_init do super(help, 0, names)
 
        redef fun read_param(it)
@@ -135,6 +142,8 @@ end
 # Option with one parameter (mandatory by default)
 abstract class OptionParameter
        super Option
+
+       # Convert `str` to a value of type `VALUE`.
        protected fun convert(str: String): VALUE is abstract
 
        # Is the parameter mandatory?
@@ -159,6 +168,7 @@ class OptionString
        super OptionParameter
        redef type VALUE: nullable String
 
+       # Init a new OptionString with a `help` message and `names`.
        init(help: String, names: String...) is old_style_init do super(help, null, names)
 
        redef fun convert(str) do return str
@@ -170,8 +180,13 @@ end
 class OptionEnum
        super OptionParameter
        redef type VALUE: Int
+
+       # Values in the enumeration.
        var values: Array[String]
 
+       # Init a new OptionEnum from `values` with a `help` message and `names`.
+       #
+       # `default` is the index of the default value in `values`.
        init(values: Array[String], help: String, default: Int, names: String...) is old_style_init do
                assert values.length > 0
                self.values = values.to_a
@@ -189,6 +204,7 @@ class OptionEnum
                return id
        end
 
+       # Get the value name from `values`.
        fun value_name: String do return values[value]
 
        redef fun pretty_default
@@ -202,6 +218,7 @@ class OptionInt
        super OptionParameter
        redef type VALUE: Int
 
+       # Init a new OptionInt with a `help` message, a `default` value and `names`.
        init(help: String, default: Int, names: String...) is old_style_init do
                super(help, default, names)
        end
@@ -214,6 +231,7 @@ class OptionFloat
        super OptionParameter
        redef type VALUE: Float
 
+       # Init a new OptionFloat with a `help` message, a `default` value and `names`.
        init(help: String, default: Float, names: String...) is old_style_init do
                super(help, default, names)
        end
@@ -227,6 +245,7 @@ class OptionArray
        super OptionParameter
        redef type VALUE: Array[String]
 
+       # Init a new OptionArray with a `help` message and `names`.
        init(help: String, names: String...) is old_style_init do
                values = new Array[String]
                super(help, values, names)
@@ -354,6 +373,7 @@ class OptionContext
                end
        end
 
+       # Options parsing errors.
        fun get_errors: Array[String]
        do
                var errors = new Array[String]