Skip to content

sbt --client ignores other flags or SBT_OPTS #6468

@laughedelic

Description

@laughedelic

steps

  1. install official sbt launcher from GitHub releases
  2. run sbt --client with any other CLI flags

problem

Other CLI flags are ignored. Examples:

►  ./sbt/bin/sbt --error --no-colors --client 'print version'
►  SBT_OPTS='-Dsbt.log.noformat=true' ./sbt/bin/sbt --client 'print version'
►  env SBT_OPTS='-Dsbt.color=false' ./sbt/bin/sbt --client 'print version'

All above commands print with colors ignoring any attempts to disable it, here is a screenshot:

You can also see that the --error (or -error) flag gets ignored, so I get the undesired logging.

I've tried passing arguments in different order and via SBT_OPTS, but it seems that the launcher just ignores anything when there is --client flag. Same happens with the sbtn native client.

expectation

In this concrete use case I would like to be able to print the version setting value without any logs or color codes.

In general, I think sbt should treat arguments in the client mode same way as in the batch mode:

Screenshot 2021-04-26 at 02 42 15

notes

►  ./sbt/bin/sbt -version
sbt version in this project: 1.5.0
sbt script version: 1.5.0

I know that the launcher script treats "client mode" specially, but I think this functionality is essential for using sbt in scripts and integrating with other CLI tools. Running sbt in batch mode several times is too slow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions