Merge branch 'alexamdre/various-fixes' into next
[nit.git] / lib / opts.nit
index fd4a8a1..59391cd 100644 (file)
@@ -79,7 +79,7 @@ class Option
 end
 
 class OptionText
-special Option
+       super Option
        init(text: String) do init_opt(text, null, null)
 
        redef fun pretty(off) do return to_s
@@ -88,7 +88,7 @@ special Option
 end
 
 class OptionBool
-special Option
+       super Option
        redef type VALUE: Bool
 
        init(help: String, names: String...) do init_opt(help, false, names)
@@ -97,7 +97,7 @@ special Option
 end
 
 class OptionCount
-special Option
+       super Option
        redef type VALUE: Int
 
        init(help: String, names: String...) do init_opt(help, 0, names)
@@ -107,7 +107,7 @@ end
 
 # Option with one mandatory parameter
 class OptionParameter
-special Option
+       super Option
        protected fun convert(str: String): VALUE is abstract
 
        redef fun read_param(it)
@@ -124,7 +124,7 @@ special Option
 end
 
 class OptionString
-special OptionParameter
+       super OptionParameter
        redef type VALUE: nullable String
 
        init(help: String, names: String...) do init_opt(help, null, names)
@@ -133,29 +133,29 @@ special OptionParameter
 end
 
 class OptionEnum
-special OptionParameter
+       super OptionParameter
        redef type VALUE: Int
-       var _enum: Array[String]
+       var _values: Array[String]
 
-       init(enum: Array[String], help: String, default: Int, names: String...)
+       init(values: Array[String], help: String, default: Int, names: String...)
        do
-               assert enum.length > 0
-               _enum = enum.to_a
-               init_opt("{help} <{enum.join(", ")}>", default, names)
+               assert values.length > 0
+               _values = values.to_a
+               init_opt("{help} <{values.join(", ")}>", default, names)
        end
 
        redef fun convert(str)
        do
-               var id = _enum.index_of(str)
+               var id = _values.index_of(str)
                return id
        end
 
-       fun value_name: String = _enum[value]
+       fun value_name: String = _values[value]
 
        redef fun pretty_default
        do
                if default_value != null then
-                       return " ({_enum[default_value.as(not null)]})"
+                       return " ({_values[default_value.as(not null)]})"
                else
                        return ""
                end
@@ -163,7 +163,7 @@ special OptionParameter
 end
 
 class OptionInt
-special OptionParameter
+       super OptionParameter
        redef type VALUE: Int
 
        init(help: String, default: Int, names: String...) do init_opt(help, default, names)
@@ -172,7 +172,7 @@ special OptionParameter
 end
 
 class OptionArray
-special OptionParameter
+       super OptionParameter
        redef type VALUE: Array[String]
 
        init(help: String, names: String...)