Sbt: support --warn, --error, --info, and --debug

Created on 11 Apr 2018  路  1Comment  路  Source: sbt/sbt

originally reported by @retronym in https://github.com/sbt/sbt/pull/2741#issuecomment-379988448

steps

$ sbt '--warn' 'eval ???'; echo $?
[warn] The `-` command is deprecated in favor of `onFailure` and will be removed in a later version
[error] scala.NotImplementedError: an implementation is missing
[error]     at scala.Predef$.$qmark$qmark$qmark(Predef.scala:284)
[error]     at $b7f279a4d8e441649156$.$sbtdef(<eval>:1)
[error]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error]     at java.lang.reflect.Method.invoke(Method.java:498)
[error]     at sbt.compiler.Eval$.getValue(Eval.scala:551)
[error]     at sbt.compiler.Eval.$anonfun$eval$1(Eval.scala:121)
[error]     at sbt.BuiltinCommands$.$anonfun$loadedEval$1(Main.scala:383)
[error]     at sbt.internal.util.ManagedLogger.log(ManagedLogger.scala:24)
[error]     at sbt.util.Logger.info(Logger.scala:22)
[error]     at sbt.BuiltinCommands$.loadedEval(Main.scala:383)
[error]     at sbt.BuiltinCommands$.$anonfun$eval$1(Main.scala:374)
[error]     at sbt.Command$.$anonfun$apply1$2(Command.scala:146)
[error]     at sbt.MainLoop$.processCommand(MainLoop.scala:154)
[error]     at sbt.MainLoop$.$anonfun$next$2(MainLoop.scala:137)
[error]     at sbt.State$$anon$1.runCmd$1(State.scala:242)
[error]     at sbt.State$$anon$1.process(State.scala:248)
[error]     at sbt.MainLoop$.$anonfun$next$1(MainLoop.scala:137)
[error]     at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error]     at sbt.MainLoop$.next(MainLoop.scala:137)
[error]     at sbt.MainLoop$.run(MainLoop.scala:130)
[error]     at sbt.MainLoop$.$anonfun$runWithNewLog$1(MainLoop.scala:108)
[error]     at sbt.io.Using.apply(Using.scala:22)
[error]     at sbt.MainLoop$.runWithNewLog(MainLoop.scala:102)
[error]     at sbt.MainLoop$.runAndClearLast(MainLoop.scala:58)
[error]     at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:43)
[error]     at sbt.MainLoop$.runLogged(MainLoop.scala:35)
[error]     at sbt.StandardMain$.runManaged(Main.scala:113)
[error]     at sbt.xMain.run(Main.scala:76)
[error]     at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
[error]     at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
[error]     at xsbt.boot.Launch$.run(Launch.scala:109)
[error]     at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
[error]     at xsbt.boot.Launch$.launch(Launch.scala:117)
[error]     at xsbt.boot.Launch$.apply(Launch.scala:18)
[error]     at xsbt.boot.Boot$.runImpl(Boot.scala:41)
[error]     at xsbt.boot.Boot$.main(Boot.scala:17)
[error]     at xsbt.boot.Boot.main(Boot.scala)
[error] scala.NotImplementedError: an implementation is missing
[error] Use 'last' for the full log.
0

problem

This gives a zero error code.

expectation

Add --warn back.

When we add --debug it should be supported in bash/batch script as well.

notes

I removed -- in https://github.com/sbt/sbt/pull/2741 and added -warn as alias. What I didn't see it coming was the interaction with - (onFailure) command.

@dwijnand was right.

Why not keep these as --debug/--warn/--error? -debug/-warn/-error is less UNIX-y that that.

This way we remove -- from making everything early to just special cases.

Bug Migration issue Regression good first issue

Most helpful comment

If no one is working on this I'd love to take a quick crack at it :)

>All comments

If no one is working on this I'd love to take a quick crack at it :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vhiairrassary picture vhiairrassary  路  3Comments

xuwei-k picture xuwei-k  路  4Comments

eed3si9n picture eed3si9n  路  3Comments

xerial picture xerial  路  3Comments

eed3si9n picture eed3si9n  路  3Comments