@@ -44,10 +44,14 @@ object Settings {
4444 case class ArgsSummary (
4545 sstate : SettingsState ,
4646 arguments : List [String ],
47- errors : List [String ]) {
47+ errors : List [String ],
48+ warnings : List [String ]) {
4849
4950 def fail (msg : String ) =
50- ArgsSummary (sstate, arguments, errors :+ msg)
51+ ArgsSummary (sstate, arguments.tail, errors :+ msg, warnings)
52+
53+ def warn (msg : String ) =
54+ ArgsSummary (sstate, arguments.tail, errors, warnings :+ msg)
5155 }
5256
5357 case class Setting [T : ClassTag ] private [Settings ] (
@@ -106,11 +110,11 @@ object Settings {
106110 }
107111
108112 def tryToSet (state : ArgsSummary ): ArgsSummary = {
109- val ArgsSummary (sstate, arg :: args, errors) = state
113+ val ArgsSummary (sstate, arg :: args, errors, warnings ) = state
110114 def update (value : Any , args : List [String ]) =
111- ArgsSummary (updateIn(sstate, value), args, errors)
115+ ArgsSummary (updateIn(sstate, value), args, errors, warnings )
112116 def fail (msg : String , args : List [String ]) =
113- ArgsSummary (sstate, args, errors :+ msg)
117+ ArgsSummary (sstate, args, errors :+ msg, warnings )
114118 def missingArg =
115119 fail(s " missing argument for option $name" , args)
116120 def doSet (argRest : String ) = ((implicitly[ClassTag [T ]], args): @ unchecked) match {
@@ -206,7 +210,7 @@ object Settings {
206210 * to get their arguments.
207211 */
208212 protected def processArguments (state : ArgsSummary , processAll : Boolean , skipped : List [String ]): ArgsSummary = {
209- def stateWithArgs (args : List [String ]) = ArgsSummary (state.sstate, args, state.errors)
213+ def stateWithArgs (args : List [String ]) = ArgsSummary (state.sstate, args, state.errors, state.warnings )
210214 state.arguments match {
211215 case Nil =>
212216 checkDependencies(stateWithArgs(skipped))
@@ -219,7 +223,7 @@ object Settings {
219223 if (state1 ne state) processArguments(state1, processAll, skipped)
220224 else loop(settings1)
221225 case Nil =>
222- state.fail (s " bad option: ' $x' " )
226+ processArguments( state.warn (s " bad option ' $x' was ignored " ), processAll, skipped )
223227 }
224228 loop(allSettings.toList)
225229 case arg :: args =>
@@ -229,7 +233,7 @@ object Settings {
229233 }
230234
231235 def processArguments (arguments : List [String ], processAll : Boolean )(implicit ctx : Context ): ArgsSummary =
232- processArguments(ArgsSummary (ctx.sstate, arguments, Nil ), processAll, Nil )
236+ processArguments(ArgsSummary (ctx.sstate, arguments, Nil , Nil ), processAll, Nil )
233237
234238 def publish [T ](settingf : Int => Setting [T ]): Setting [T ] = {
235239 val setting = settingf(_allSettings.length)
0 commit comments