<commit_before>#!/usr/bin/env node
const spawn = require('child_process').spawn
const electron = require('electron-prebuilt')
const path = require('path')
const fs = require('fs')

const serverPath = path.join(__dirname, '../server.js')
const md = process.argv[2]
var args = [serverPath]

if (md) {
  var stat

  try {
    stat = fs.statSync(path.resolve(md))
  } catch (e) {
    console.error('Cannot open', md + ':', e.code === 'ENOENT' ? 'no such file' : e.message)
    process.exit(1)
  }

  if (stat.isDirectory()) {
    console.error('Cannot open', md + ': is a directory')
    process.exit(1)
  }

  args.push(md)
} else if (process.stdin.isTTY) {
  console.error('No file path specified')
  process.exit(1)
}

// spawn electron
var proc = spawn(electron, args)

// pipe stdin into child process, if something was piped in
if (!md) {
  process.stdin.pipe(proc.stdin)<commit_msg>Default to README.md<commit_after>#!/usr/bin/env node
const spawn = require('child_process').spawn
const electron = require('electron-prebuilt')
const path = require('path')
const fs = require('fs')

const serverPath = path.join(__dirname, '../server.js')
const md = process.argv[2] || (process.stdin.isTTY ? 'README.md' : null)
var args = [serverPath]

if (md) {
  var stat

  try {
    stat = fs.statSync(path.resolve(md))
  } catch (e) {
    console.error('Cannot open', md + ':', e.code === 'ENOENT' ? 'no such file' : e.message)
    process.exit(1)
  }

  if (stat.isDirectory()) {
    console.error('Cannot open', md + ': is a directory')
    process.exit(1)
  }

  args.push(md)
} else if (process.stdin.isTTY) {
  console.error('No file path specified')
  process.exit(1)
}

// spawn electron
var proc = spawn(electron, args)

// pipe stdin into child process, if something was piped in
if (!md) {
  process.stdin.pipe(proc.stdin)
{'fraction_non_alphanumeric': 0.16566099835436093, 'fraction_numerical': 0.004388370817334065, 'mean_word_length': 3.7131782945736433, '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': '5763739', 'n_tokens_mistral': 648, 'n_tokens_neox': 630, 'n_words': 164}