harrah/xsbt — pull request #274 by eed3si9n (2011-11-22 07:27:25+00:00)
Title: "inspect tree <key>" command

## overview
This is a slightly cleaned up version of [sbt-inspectr][1].
When `inspect tree ` is called, `SettingGraph` case class is created recursively
along the dependencies, calling the similar code as `inspect` command's `Project.details`.
`SettingGraph` extends `Graph` trait, which is able to render itself as an ascii tree.

[1]: https://github.com/eed3si9n/sbt-inspectr

## sample usage

```
> inspect
Display all 217 possibilities? (y or n)
> inspect tree pa
package package-bin package-configuration
package-doc package-options package-src
packaged-artifact packaged-artifacts parallel-execution
> inspect tree package
[info] compile:package = Task[java.io.File]
[info] +-compile:package-bin = Task[java.io.File]
[info] +-compile:package-configuration(for package-bin) = Task[sbt.Packag..
[info] | +-compile:mappings(for package-bin) = Task[scala.collection.Seq[..
[info] | | +-compile:products = Task[scala.collection.Seq[java.io.File]]
[info] | |
[info] | +-compile:artifact-path(for package-bin) = target/scala-2.9.1/he..
[info] | | +-*:cross-target = target/scala-2.9.1
[info] | | +-compile:artifact(for package-bin) = Artifact(helloworld,jar,..
[info] | | | +-*/*:artifact-classifier = None
[info] | | | +-compile:configuration = compile
[info] | | |
[info] | | +-*/*:scala-version = 2.9.1
[info] | | +-*:project-id = production:helloworld:0.1-SNAPSHOT
[info] | | +-*/*:artifact-name =
[info] | |
[info] | +-compile:package-options(for package-bin) = Task[scala.collecti..
[info] | +-*:organization = production
[info] | +-*:name = helloworld
[info] | +-compile:main-class = Task[scala.Option[java.lang.String]]
[info] | +-*/*:version = 0.1-SNAPSHOT
[info] | +-*/*:homepage = None
[info] | +-*:organization-name = production
[info] | +-*/*:package-options = Task[scala.collection.Seq[sbt.PackageO..
[info] |
[info] +-compile:cache-directory(for package-bin) = target/scala-2.9.1/ca..
[info] +-compile:streams(for package-bin) = Task[sbt.std.TaskStreams[sbt...
[info] +-*/*:streams-manager = Task[sbt.std.Streams[sbt.Init$ScopedKey[..
[info]
> inspect package
[info] Task: java.io.File
[info] Description:
[info]	Produces the main artifact, such as a binary jar. This is typically an alias for the task that actually does the packaging.
[info] Provided by:
[info]	{file:/Users/eed3si9n/work/helloworld/}default-b65acd/compile:package
[info] Dependencies:
[info]	compile:package-bin
[info] Delegates:
[info]	compile:package
[info]	*:package
[info]	{.}/compile:package
[info]	{.}/*:package
[info]	*/compile:package
[info]	*/*:package
[info] Related:
[info]	test:package
> inspect actual package
[info] Task: java.io.File
[info] Description:
[info]	Produces the main artifact, such as a binary jar. This is typically an alias for the task that actually does the packaging.
[info] Provided by:
[info]	{file:/Users/eed3si9n/work/helloworld/}default-b65acd/compile:package
[info] Dependencies:
[info]	compile:package-bin
[info] Delegates:
[info]	compile:package
[info]	*:package
[info]	{.}/compile:package
[info]	{.}/*:package
[info]	*/compile:package
[info]	*/*:package
[info] Related:
[info]	test:package
> help inspect

inspect [tree]

For a plain setting, the value bound to the key argument is displayed using its toString method.
Otherwise, the type of task ("Task" or "Input task") is displayed.

"Dependencies" shows the settings that this setting depends on.
If 'tree' is specified, the bound value as well as the settings that this setting depends on
(and their bound values) are displayed as a tree structure.

"Reverse dependencies" shows the settings that depend on this setting.

When a key is resolved to a value, it may not actually be defined in the requested scope.
In this case, there is a defined search sequence.
"Delegates" shows the scopes that are searched for the key.
"Provided by" shows the scope that contained the value returned for the key.

"Related" shows all of the scopes in which the key is defined.

>
```