<commit_before>package scalex

import scalex.dump.{Dumper, Locator}
import scalex.db.DefRepo
import scalex.model.Def
import scalex.signature.Signature
import scalex.search.Search
import java.io.File

object Cli {

  def dumper = new Dumper

  def locator = new Locator

  def main(args: Array[String]): Unit = sys exit {
    println(args.head match {
      case "dump" => dump(args.toList.tail)
      case "list" => list
      case "search" => search(args.toList.tail mkString " ")
      case command => "Unknown command " + command
    })
    0
  }

  def list: String = render(DefRepo.findAll.toList)

  def search(query: String): String = (Search find query).right map (_.take(10).toList) match {
    case Left(msg) => msg
    case Right(results) =>
      "%d results for %s\n\n%s" format (results.length, query, render(results))
  }

  private def render(d: Def): String =
    d.name + "\n  " + d.toString + (
      if (d.commentText != "") "\n  " + d.commentText
      else ""
    )

  private def render(ds: List[Def]): String =
    ds map render map ("* "+) mkString "\n\n"

  def dump(fs: List[String]): String = {
    val files = fs map (f => new File(f))
    val sources = locator locate files map (_.getPath)
    dumper.process(sources)
    "Dump complete"
    //list
  }
}<commit_msg>Show functions short comments in Cli<commit_after>package scalex

import scalex.dump.{Dumper, Locator}
import scalex.db.DefRepo
import scalex.model.Def
import scalex.signature.Signature
import scalex.search.Search
import java.io.File

object Cli {

  def dumper = new Dumper

  def locator = new Locator

  def main(args: Array[String]): Unit = sys exit {
    println(args.head match {
      case "dump" => dump(args.toList.tail)
      case "list" => list
      case "search" => search(args.toList.tail mkString " ")
      case command => "Unknown command " + command
    })
    0
  }

  def list: String = render(DefRepo.findAll.toList)

  def search(query: String): String = (Search find query).right map (_.take(10).toList) match {
    case Left(msg) => msg
    case Right(results) =>
      "%d results for %s\n\n%s" format (results.length, query, render(results))
  }

  private def render(d: Def): String =
    d.name + "\n  " + d.toString + "\n" + (
      d.comment map (_.short) getOrElse "no comment"
    )

  private def render(ds: List[Def]): String =
    ds map render map ("* "+) mkString "\n\n"

  def dump(fs: List[String]): String = {
    val files = fs map (f => new File(f))
    val sources = locator locate files map (_.getPath)
    dumper.process(sources)
    "Dump complete"
    //list
  }
}
{'fraction_non_alphanumeric': 0.1365554276946682, 'fraction_numerical': 0.0023014959723820483, 'mean_word_length': 2.9695585996955858, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1541126', 'n_tokens_mistral': 884, 'n_tokens_neox': 858, 'n_words': 251}