@@ -69,11 +69,11 @@ object Settings:
6969
7070 def updateIn (state : SettingsState , x : Any ): SettingsState = x match
7171 case _ : T => state.update(idx, x)
72- case _ => throw IllegalArgumentException (s " found: $x of type ${x.getClass.getName}, required: ${implicitly [ClassTag [T ]]}" )
72+ case _ => throw IllegalArgumentException (s " found: $x of type ${x.getClass.getName}, required: ${summon [ClassTag [T ]]}" )
7373
7474 def isDefaultIn (state : SettingsState ): Boolean = valueIn(state) == default
7575
76- def isMultivalue : Boolean = implicitly [ClassTag [T ]] == ListTag
76+ def isMultivalue : Boolean = summon [ClassTag [T ]] == ListTag
7777
7878 def legalChoices : String =
7979 choices match {
@@ -106,6 +106,11 @@ object Settings:
106106 def missingArg =
107107 fail(s " missing argument for option $name" , args)
108108
109+ def setBoolean (argValue : String , args : List [String ]) =
110+ if argValue.equalsIgnoreCase(" true" ) || argValue.isEmpty then update(true , args)
111+ else if argValue.equalsIgnoreCase(" false" ) then update(false , args)
112+ else fail(s " $argValue is not a valid choice for boolean setting $name" , args)
113+
109114 def setString (argValue : String , args : List [String ]) =
110115 choices match
111116 case Some (xs) if ! xs.contains(argValue) =>
@@ -126,9 +131,9 @@ object Settings:
126131 catch case _ : NumberFormatException =>
127132 fail(s " $argValue is not an integer argument for $name" , args)
128133
129- def doSet (argRest : String ) = ((implicitly [ClassTag [T ]], args): @ unchecked) match {
134+ def doSet (argRest : String ) = ((summon [ClassTag [T ]], args): @ unchecked) match {
130135 case (BooleanTag , _) =>
131- update( true , args)
136+ setBoolean(argRest , args)
132137 case (OptionTag , _) =>
133138 update(Some (propertyClass.get.getConstructor().newInstance()), args)
134139 case (ListTag , _) =>
@@ -290,6 +295,6 @@ object Settings:
290295 publish(Setting (name, descr, default))
291296
292297 def OptionSetting [T : ClassTag ](name : String , descr : String , aliases : List [String ] = Nil ): Setting [Option [T ]] =
293- publish(Setting (name, descr, None , propertyClass = Some (implicitly [ClassTag [T ]].runtimeClass), aliases = aliases))
298+ publish(Setting (name, descr, None , propertyClass = Some (summon [ClassTag [T ]].runtimeClass), aliases = aliases))
294299 }
295300end Settings
0 commit comments