<commit_before>#!/usr/bin/env node

var makeTable = require('./makeTable.js')
var fs = require('fs')

var key = process.argv[2]

var save = false

if (process.argv[3] && process.argv[3].match("--save")) {
  save = true
}

if (key && !save) {
  makeTable(key, function callback(err, table) {
    if (err != "null") return console.log(err)

    console.log(table)
  })
}

if (key && save) {
  makeTable(key, function callback(err, table) {
    if (err != "null") return console.log(err)

    fs.writeFile('table.md', table.toString(), function (err) {
      if (err) return console.log(err)
    })
    console.log('table has been created and saved')
  })
}

if (!key) {
  return console.log("To use: `$ sheetdown SPREADSHEETKEY --save`\n" +
                     "Or: `$ sheetdown SPREADSHEETKEY | pbcopy")
}
<commit_msg>fix #8<commit_after>#!/usr/bin/env node

var makeTable = require('./makeTable.js')
var fs = require('fs')

var key = process.argv[2]

var save = false

if (process.argv[3] && process.argv[3].match("--save")) {
  save = true
}

if (key && !save) {
  makeTable(key, function callback(err, table) {
    if (err != "null") return console.error(err)

    console.log(table)
  })
}

if (key && save) {
  makeTable(key, function callback(err, table) {
    if (err != "null") return console.error(err)

    fs.writeFile('table.md', table.toString(), function (err) {
      if (err) return console.error(err)
    })
    console.log('table has been created and saved')
  })
}

if (!key) {
  return console.log("To use: `$ sheetdown SPREADSHEETKEY --save`\n" +
                     "Or: `$ sheetdown SPREADSHEETKEY | pbcopy")
}

{'fraction_non_alphanumeric': 0.1779816513761468, 'fraction_numerical': 0.004281345565749235, 'mean_word_length': 3.194871794871795, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3149510', 'n_tokens_mistral': 591, 'n_tokens_neox': 580, 'n_words': 141}