<commit_before>/**
 * Created by gkt on 7/2/17.
 */

import scopt._

object Import {

  case class Config(database: Option[String] = None, dir: Option[String] = None, validate: Boolean = false)

  def parseCommandLine(args: Array[String]): Option[Config] = {
    val parser = new scopt.OptionParser[Config]("scopt") {
      head("ZettelGeist Import", "0.1.x")
      opt[String]('d', "database") action { (value, config) =>
        config.copy(database = Some(value))
      } text ("name of database (H2)")
      opt[String]('p', "path") action { (value, config) =>
        config.copy(database = Some(value))
      } text ("path to Zettel directory")
      opt[Unit]('v', "validate") action { (_, config) =>
        config.copy(validate = true)
      } text ("check validity of Zettels only (does not import into index)")
      help("help") text ("show help")
    }
    parser.parse(args, Config())
  }

  def main(args: Array[String]) = {
    val config = parseCommandLine(args)
    println(config)<commit_msg>add package info<commit_after>/**
 * Created by gkt on 7/2/17.
 */

package zettelgeist

import scopt._

object Import {

  case class Config(database: Option[String] = None, dir: Option[String] = None, validate: Boolean = false)

  def parseCommandLine(args: Array[String]): Option[Config] = {
    val parser = new scopt.OptionParser[Config]("scopt") {
      head("ZettelGeist Import", "0.1.x")
      opt[String]('d', "database") action { (value, config) =>
        config.copy(database = Some(value))
      } text ("name of database (H2)")
      opt[String]('p', "path") action { (value, config) =>
        config.copy(database = Some(value))
      } text ("path to Zettel directory")
      opt[Unit]('v', "validate") action { (_, config) =>
        config.copy(validate = true)
      } text ("check validity of Zettels only (does not import into index)")
      help("help") text ("show help")
    }
    parser.parse(args, Config())
  }

  def main(args: Array[String]) = {
    val config = parseCommandLine(args)
    println(config)
{'fraction_non_alphanumeric': 0.1603128054740958, 'fraction_numerical': 0.006842619745845552, 'mean_word_length': 3.336864406779661, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '2332662', 'n_tokens_mistral': 659, 'n_tokens_neox': 641, 'n_words': 175}