<commit_before>const ora = require('ora')
const download = require('download-git-repo')
const utils = require('./utils.js')

const SPEIKE_DOWNLOAD = Symbol('speike-cli#downloadAndGenerate')

class init {
  constructor(options) {
    this.options = options
  }

  run() {
    const {template: rawTemplate, targetPath, clone} = this.options
    const template = rawTemplate.indexOf('/') > -1 ? rawTemplate : 'haotech/' + rawTemplate

    this[SPEIKE_DOWNLOAD]({template, targetPath, clone})
  }

  /**
   * Download Template
   */
  [SPEIKE_DOWNLOAD]({template, targetPath, clone}) {
    const spinner = ora('downloading template')
    spinner.start()

    function ensureTargetPath(targetPath) {
      return utils.isExist(targetPath) ? utils.rmdir(targetPath) : Promise.resolve()
    }

    ensureTargetPath(targetPath).then(() => {
      download(template, targetPath, {clone}, err => {
        spinner.stop()<commit_msg>code clear<commit_after>const ora = require('ora')
const download = require('download-git-repo')
const utils = require('./utils.js')

const SPEIKE_DOWNLOAD = Symbol('speike-cli#downloadAndGenerate')

class init {
  constructor(options) {
    this.options = options
  }

  run() {
    const {template: rawTemplate, targetPath, clone} = this.options
    const template = rawTemplate.indexOf('/') > -1
      ? rawTemplate
      : 'haotech/' + rawTemplate

    this[SPEIKE_DOWNLOAD]({template, targetPath, clone})
  }

  /**
   * Download Template
   */
  [SPEIKE_DOWNLOAD]({template, targetPath, clone}) {
    const spinner = ora('downloading template')
    spinner.start()

    function ensureTargetPath(targetPath) {
      return utils.isExist(targetPath)
        ? utils.rmdir(targetPath)
        : Promise.resolve()
    }

    ensureTargetPath(targetPath).then(() => {
      download(template, targetPath, {clone}, err => {
        spinner.stop()
{'fraction_non_alphanumeric': 0.13911182450508294, 'fraction_numerical': 0.001070090957731407, 'mean_word_length': 3.675, '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': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2581451', 'n_tokens_mistral': 574, 'n_tokens_neox': 567, 'n_words': 112}