<commit_before>#! /usr/bin/env node
'use strict'

const inquirer = require('inquirer')
const clear    = require('clear')
const asciify  = require('asciify')
const chalk    = require('chalk')
const fs       = require('fs')
const path     = require('path')

const questions = require('./questions')

clear()

asciify('EmRep', {font:'Lean',color:'cyan'}, (err,res) => {
  // console.log(res)
  init()
})

var prompt = inquirer.createPromptModule()

function init() {
  mainMenu(true)
}

function mainMenu(init) {
  if (!init) {
    clear()
  }
  console.log(questions.csv)

  prompt(questions.main).then((answers) => {
    // console.log(answers.mainMenu);

    switch (answers.mainMenu) {
      case 'loadCSV' :
        loadCSV()
        break
      case 'loadHTML' :
        loadHTML()
        break
      case 'export' :
        exportHTML()
        break
      case 'exit' :
        quitEmRep()
        break
    }
  });
}

function loadCSV() {
  var i
  var csvQ = questions.csv

  clear()

  fs.readdir('.', (err, files) => {
    if (files.length) {
      for (i in files) {
        if (path.extname(files[i]) == '.csv') {
          csvQ[0].choices.push({name:files[i]})
        }
      }
      if (csvQ[0].choices.length) {
        csvQ[0].choices.push(new inquirer.Separator())
        csvQ[0].choices.push({name: '<- Voltar',value:'back'})
        prompt(csvQ).then((answers) => {
          if (answers.chooseCSV != 'back') {
            console.log(answers.chooseCSV)
          }
          csvQ[0].choices = []
          mainMenu()
        })
      } else {
        console.log(chalk.bgRed(' Nenhum arquivo encontrado '))
        mainMenu()
      }
    } else {
      console.log(chalk.bgRed(' Nenhum arquivo encontrado '))
      mainMenu()
    }
  })
}

function loadHTML() {
  console.log('HTML')
}

function exportHTML() {
  console.log('Export')
}

function quitEmRep() {
  clear()
  console.log('End')
}
<commit_msg>Cria pasta de exemplos, procura CSV mas ainda não trabalha<commit_after>#! /usr/bin/env node
'use strict'

const inquirer = require('inquirer')
const clear    = require('clear')
const asciify  = require('asciify')
const chalk    = require('chalk')
const fs       = require('fs')
const path     = require('path')

const questions = require('./questions')

clear()

asciify('EmRep', {font:'Lean',color:'cyan'}, (err,res) => {
  // console.log(res)
  init()
})

var prompt = inquirer.createPromptModule()

function init() {
  mainMenu(true)
}

function mainMenu(init) {
  if (!init) {
    clear()
  }

  prompt(questions.main).then((answers) => {
    switch (answers.mainMenu) {
      case 'loadCSV' :
        loadCSV()
        break
      case 'loadHTML' :
        loadHTML()
        break
      case 'export' :
        exportHTML()
        break
      case 'exit' :
        quitEmRep()
        break
    }
  });
}

function loadCSV() {
  var i
  var csvQ = questions.csv

  clear()

  fs.readdir('.', (err, files) => {
    if (files.length) {
      for (i in files) {
        if (path.extname(files[i]) == '.csv') {
          csvQ[0].choices.push({name:files[i]})
        }
      }
      if (csvQ[0].choices.length) {
        csvQ[0].choices.push(new inquirer.Separator())
        csvQ[0].choices.push({name: '<- Voltar',value:'back'})
        prompt(csvQ).then((answers) => {
          if (answers.chooseCSV != 'back') {
            console.log(answers.chooseCSV)
          }
          csvQ[0].choices = []
          mainMenu()
        })
      } else {
        console.log(chalk.bgRed(' Nenhum arquivo encontrado '))
        mainMenu()
      }
    } else {
      console.log(chalk.bgRed(' Nenhum arquivo encontrado '))
      mainMenu()
    }
  })
}

function loadHTML() {
  console.log('HTML')
}

function exportHTML() {
  console.log('Export')
}

function quitEmRep() {
  clear()
  console.log('End')
}

{'fraction_non_alphanumeric': 0.16592747195408297, 'fraction_numerical': 0.0026089225150013043, 'mean_word_length': 2.3223570190641247, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '6128073', 'n_tokens_mistral': 1364, 'n_tokens_neox': 1324, 'n_words': 247}