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

var nopt = require('nopt')
  , log = require('npmlog')
  , path = require('path')
  , pkg = require('../package')
  , split = require('split')
  , fs = require('fs')
  , Parser = require('../').Parser
  , Message = require('../').Message
  , Segment = require('../').Segment
  , knownOpts = { loglevel: ['verbose', 'info', 'error', 'warn', 'silent']
                , file: path
                , help: Boolean
                , version: Boolean
                , segments: Boolean
                , count: Boolean
                , json: Boolean
                }
  , shortHand = { verbose: ['--loglevel', 'verbose']
                , quiet: ['--loglevel', 'silent']
                , f: ['--file']
                , v: ['--version']
                , h: ['--help']
                , H: ['--help']
                , s: ['--segments']
                , c: ['--count']
                , j: ['--json']
                }
  , parsed = nopt(knownOpts, shortHand)

log.heading = 'nodengine-hl7'

if (parsed.loglevel) log.level = parsed.loglevel

if (parsed.json) parsed.loglevel = 'quiet'

if (parsed.help) {
  return help()
}

if (parsed.version) {
  console.log('nehl7', 'v'+pkg.version)
  process.exit()
}

function help() {
  console.log('nehl7', 'v'+pkg.version)
  console.log()
  console.log(' usage: nehl7 [options]')
  console.log()
  console.log(' options:')
  console.log()
  console.log('   --loglevel <level>', '      ', 'set the log level')
  console.log('   --file <file>', '           ', 'parse file')
  console.log('   --segments', '              ', 'only show segment types')
  console.log('   --count', '                 ', 'print message count')
  console.log('   --json', '                  ', 'print output in json')
  console.log('   --help', '                  ', 'shows help and usage')
  console.log('   --version', '               ', 'shows the current version')
  process.exit(1)
}

var buf = ''
  , parser = new Parser()
  , stream
process.stdin.setEncoding('utf8')
<commit_msg>Show aliases in help too<commit_after>#!/usr/bin/env node

var nopt = require('nopt')
  , log = require('npmlog')
  , path = require('path')
  , pkg = require('../package')
  , split = require('split')
  , fs = require('fs')
  , Parser = require('../').Parser
  , Message = require('../').Message
  , Segment = require('../').Segment
  , knownOpts = { loglevel: ['verbose', 'info', 'error', 'warn', 'silent']
                , file: path
                , help: Boolean
                , version: Boolean
                , segments: Boolean
                , count: Boolean
                , json: Boolean
                }
  , shortHand = { verbose: ['--loglevel', 'verbose']
                , quiet: ['--loglevel', 'silent']
                , f: ['--file']
                , v: ['--version']
                , h: ['--help']
                , H: ['--help']
                , s: ['--segments']
                , c: ['--count']
                , j: ['--json']
                }
  , parsed = nopt(knownOpts, shortHand)

log.heading = 'nodengine-hl7'

if (parsed.loglevel) log.level = parsed.loglevel

if (parsed.json) parsed.loglevel = 'quiet'

if (parsed.help) {
  return help()
}

if (parsed.version) {
  console.log('nehl7', 'v'+pkg.version)
  process.exit()
}

function help() {
  console.log('nehl7', 'v'+pkg.version)
  console.log()
  console.log(' usage: nehl7 [options]')
  console.log()
  console.log(' options:')
  console.log()
  console.log('   -l, --loglevel <level>', '      ', 'set the log level')
  console.log('   -f, --file <file>', '           ', 'parse file')
  console.log('   -s, --segments', '              ', 'only show segment types')
  console.log('   -c, --count', '                 ', 'print message count')
  console.log('   -j, --json', '                  ', 'print output in json')
  console.log('   -h, --help', '                  ', 'shows help and usage')
  console.log('   -v, --version', '               ', 'shows the current version')
  process.exit(1)
}

var buf = ''
  , parser = new Parser()
  , stream
process.stdin.setEncoding('utf8')

{'fraction_non_alphanumeric': 0.19168085623935782, 'fraction_numerical': 0.002918997810751642, 'mean_word_length': 1.8068259385665528, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '7516483', 'n_tokens_mistral': 1321, 'n_tokens_neox': 1292, 'n_words': 301}