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

var build = require('./')
var minimist = require('minimist')
var tstream = require('tar-stream')
var tar = require('tar-fs')
var concat = require('concat-stream')
var ignore = require('ignore-file')

var join = function(a, b) {
  if (!a) return b
  if (!b) return a
  return function(filename) {
    return a(filename) || b(filename)
  }
}

var argv = minimist(process.argv, {
  boolean: ['cache', 'version'],
  alias: {
    tag: 't',
    quiet: 'q',
    version: 'v',
    host: 'H'
  },
  default: {
    cache: true
  }
})

var tag = argv._[2]
var path = argv._[3] || '.'

if (argv.version) {
  console.log(require('./package').version)
  process.exit(0)
}

if (argv.help || !tag) {
  console.error(
    'Usage: docker-build [tag] [path?] [options]\n'+
    '\n'+
    '  --host,    -H   [docker-host]\n'+
    '  --quiet,   -q\n'+
    '  --version, -v\n'+
    '  --no-cache\n'+
    '  --no-ignore\n'
  )
  process.exit(1)
}

var onerror = function(err) {
  console.error(err.message)
  process.exit(2)
}

var opts = {
  host: argv.host,
  cache: argv.cache,
  quiet: argv.quiet
}

var input = function() {
  if (path !== '-') {
    var filter = ignore.sync('.dockerignore') || join(ignore.compile('.git'), ignore.sync('.gitignore'))
    if (argv.ignore === false) filter = null
    return tar.pack(path, {filter:filter})<commit_msg>fix typo in ignore option<commit_after>#!/usr/bin/env node

var build = require('./')
var minimist = require('minimist')
var tstream = require('tar-stream')
var tar = require('tar-fs')
var concat = require('concat-stream')
var ignore = require('ignore-file')

var join = function(a, b) {
  if (!a) return b
  if (!b) return a
  return function(filename) {
    return a(filename) || b(filename)
  }
}

var argv = minimist(process.argv, {
  boolean: ['cache', 'version'],
  alias: {
    tag: 't',
    quiet: 'q',
    version: 'v',
    host: 'H'
  },
  default: {
    cache: true
  }
})

var tag = argv._[2]
var path = argv._[3] || '.'

if (argv.version) {
  console.log(require('./package').version)
  process.exit(0)
}

if (argv.help || !tag) {
  console.error(
    'Usage: docker-build [tag] [path?] [options]\n'+
    '\n'+
    '  --host,    -H   [docker-host]\n'+
    '  --quiet,   -q\n'+
    '  --version, -v\n'+
    '  --no-cache\n'+
    '  --no-ignore\n'
  )
  process.exit(1)
}

var onerror = function(err) {
  console.error(err.message)
  process.exit(2)
}

var opts = {
  host: argv.host,
  cache: argv.cache,
  quiet: argv.quiet
}

var input = function() {
  if (path !== '-') {
    var filter = ignore.sync('.dockerignore') || join(ignore.compile('.git'), ignore.sync('.gitignore'))
    if (argv.ignore === false) filter = null
    return tar.pack(path, {ignore:filter})
{'fraction_non_alphanumeric': 0.2046613255644574, 'fraction_numerical': 0.003641660597232338, 'mean_word_length': 2.89645390070922, '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': '4116213', 'n_tokens_mistral': 1042, 'n_tokens_neox': 1029, 'n_words': 235}