REPL中的scala api文档

时间:2014-11-17 08:13:58

标签: scala sbt

我是Scala编程的新手,并且喜欢在eclipse之外的终端编码,因为它非常好。我找不到任何信息的一件事是如何检索Scala REPL上的api文件(即“scala”或“sbt”命令),如python或ipython响应在help()或放“?”分别在api的末尾。即使Scala似乎没有像Python的“pydoc”或C语言的“man”那样的命令。

找到api文档的唯一方法是使用网络表单浏览文档还是错过了?

1 个答案:

答案 0 :(得分:3)

  

找到api文档的唯一方法是使用网络表单浏览文档还是丢失?

此时此情况确实如此。

我写了一个sbt插件sbt-man,但它的能力是有限的。

> man Traversable /:
[man] scala.collection.Traversable
[man] def /:[B](z: B)(op: (B ⇒ A ⇒ B)): B
[man] Applies a binary operator to a start value and all elements of this
collection, going left to right. Note: /: is alternate syntax for foldLeft;
z /: xs is the same as xs foldLeft z. Note: will not terminate for infinite-
sized collections. Note: might return different results for different runs,
unless the underlying collection type is ordered. or the operator is
associative and commutative. 

为了便于下载,我还写了doctrine

$ doctrine "org.scala-lang" % "scala-library" % "2.11.2" -o ~/doc
[info] unzippped documents to /Users/foo/doc/scala-library-2.11.2-javadoc