<commit_before>#!/usr/bin/env node
const {file} = require(`./lib/util/jsx-to-pug`).default
const {json} = require(`./lib/util/fs`).default
const yaml = require('./lib/util/yaml').default
const program = require(`commander`)

program
  .version(`0.0.1`)
  .option(`-d, --debug`, `log additional info`)
  .option(`-p, --props <p>`, `raw props`, yaml)
  .option(`-f, --file <f>`, `prop file`, json)
  .parse(process.argv)

if (!program.props && !program.file) {
  process.stderr.write(
    `glass needs props in order to render (glass -p={} json) or (glass -f=propfile.json file)`
  )
}

const filename = program.args[0]
if (!filename) {
  process.stderr.write(`glass expected to be given filename to consume (glass -p={} file)`)
}

const props = program.props || program.file

file.toPug(props, filename).fork(
  (e) => process.stderr.write(e),
  (p) => process.stdout.write(p)
)<commit_msg>Minor updates to cli.<commit_after>#!/usr/bin/env node
const {file} = require(`./lib/util/jsx-to-pug`).default
const {json} = require(`./lib/util/fs`).default
const yaml = require('./lib/util/yaml').default
const program = require(`commander`)

program
  .version(`0.0.1`)
  .option(`-d, --debug`, `log additional info`)
  .option(`-p, --props <p>`, `raw props`, yaml)
  .option(`-f, --file <f>`, `prop file`, json)
  .parse(process.argv)

if (!program.props && !program.file) {
  process.stderr.write([
    `glass needs props in order to render`,
    `(glass -p "text: value\nlink: item" file.jsx) or`,
    `(glass -f file.json file.jsx)\n`
  ].join(` `))
  process.exit(1)
}

const filename = program.args[0]
if (!filename) {
  process.stderr.write(`glass expected to be given filename to consume (glass -f json file.js)`)
  process.exit(1)
}

const props = program.props || program.file

file.toPug(props, filename).fork(
  (e) => process.stderr.write(e),
  (p) => process.stdout.write(p)
)
{'fraction_non_alphanumeric': 0.20191285866099895, 'fraction_numerical': 0.005313496280552604, 'mean_word_length': 3.840616966580977, 'pattern_counts': {'":': 0, '<': 7, '<?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': '7066173', 'n_tokens_mistral': 686, 'n_tokens_neox': 676, 'n_words': 167}