5

Take for example the command sbt "inspect tree clean".

This truncates its output (with ..) to the width of the terminal, or 40 characters if redirected to a file.

C:\dev>sbt "inspect tree clean"
[info] Loading project definition from C:\dev\project
[info] Set current project to dev (in build file:/C:/dev/)
[info] *:clean = Task[Unit]
[info]   +-*:clean::streams = Task[sb..
[info]   | +-*/*:streamsManager = Tas..

How can I make it print out the entire line without any truncation? I've searched the documentation at scala-sbt.org but cannot find anything relevant.

I'm using sbt 0.13.8 on Windows.

OrangeDog
  • 36,653
  • 12
  • 122
  • 207
  • I believe it's the `inspect tree` that truncates its output, not the sbt. However, it doesn't help the problem much. – Haspemulator May 27 '16 at 08:28

2 Answers2

4

Apparently, you can't. Here's the relevant code in SBT: https://github.com/sbt/sbt/blob/0.13/main/src/main/scala/sbt/SettingGraph.scala#L58

The relevant part is:

val defaultWidth = 40
val maxColumn = math.max(JLine.usingTerminal(_.getWidth), defaultWidth) - 8

So in interactive mode you get a width of your terminal - 8, in stdout you get 32 chars. I don't see anywhere it's configurable, so your best take is to run this in a very wide terminal window. :)

EDIT: as I've written in comment, I've submitted a PR for SBT that makes this value configurable via setting. Now, more than 1 year waiting, this setting is finally a part of SBT 1.0. To increase the output width, you can either add following line in your build.sbt:

asciiGraphWidth := <some big enough number>

or execute this command directly in SBT console:

set asciiGraphWidth := <some big enough number>
Haspemulator
  • 11,050
  • 9
  • 49
  • 76
  • Well that's pretty annoying. I've got two widescreen monitors and some lines are still long enough to get truncated. – OrangeDog May 27 '16 at 09:06
  • Maybe create an issue for them on Github? I definitely see a benefit of this length being configurable, especially in the non-interactive mode. – Haspemulator May 27 '16 at 09:09
  • 1
    @OrangeDog FWIW, I've sent them a pull request which makes the maximum width configurable: https://github.com/sbt/sbt/pull/2633. It's hanging there for several days without much progress. If you want this faster, consider commenting/voting on the PR. – Haspemulator Jun 03 '16 at 08:19
  • The pull request was accepted and should be visible for SBT 1.0.0. Although SBT 1.0.0.-M4 was released a while ago, there is no release date for [final](https://github.com/sbt/sbt/milestone/6) and it could be a while. – Mike Slinn Feb 21 '17 at 23:12
  • upcoming sbt will have a new setting for this, see https://github.com/sbt/sbt/pull/2633/commits/69a4d9e06d144453b64ee2e4b3b18eef926906c9 – philwalk May 12 '17 at 19:51
  • if the default is raised above 40 how can I view the graphs on my Apple II+? – Seth Tisue Oct 18 '17 at 23:16
  • @SethTisue luckily the default value hasn't changed! :) – Haspemulator Oct 19 '17 at 12:47
3

In sbt 1.0.0 or newer you can run:

sbt 'set asciiGraphWidth := 10000' 'inspect tree clean'

Andrew Gaul
  • 2,296
  • 1
  • 12
  • 19