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

var url = require('url');
var child_process = require('child_process');
var util = require('util');

subcommands = {
  '--help': { help: true },
  'run': { exec: 'mongo', db: ["DB"] },
  'dump': { exec: 'mongodump', db: ["--db", "DB"] },
  'restore': { exec: 'mongorestore', db: ["--db", "DB"] },
  'import': { exec: 'mongoimport', db: ["--db", "DB"] },
  'export': { exec: 'mongoexport', db: ["--db", "DB"] },
  'files': { exec: 'mongofiles', db: ["--db", "DB"] },
  'oplog': { exec: 'mongooplog', db: ["--db", "DB"] },
  'stat': { exec: 'mongostat', db: [] },
  'top': { exec: 'mongotop', db: [] }
};

function main() {
  args = parseArgs(process.argv.slice(2));

  if (args.command.help)
    printUsageAndExit();

  var mUrl = getMeteorMongoUrl(args.site);
  var urlObj = url.parse(mUrl);
  var newArgs = buildArgs (args.command, args.commandArgs, urlObj);

  if (process.platform === 'win32') {
	  args.command.exec += '.bat';
  }

  if (args.dryRun) {
    var fullCommand = shellQuote([args.command.exec].concat(newArgs));
    console.log(fullCommand);
    // console.log([args.command.exec].concat(newArgs));
  } else {
    child_process.spawn(args.command.exec, newArgs, { stdio: 'inherit' });
  }
}

function parseArgs(args) {
  parsedArgs = {};

  // 1. Flags to mmongo

  if (args[0] === '--dry') {
    parsedArgs.dryRun = true;
    args.shift();
  }

  // 2. A site is specified unless we go directly to the command

  if (!(args[0] in subcommands) && args.length > 0) {
    parsedArgs.site = args[0];
    args.shift();
  } else {<commit_msg>Don't add '.bat' to mongo command<commit_after>#!/usr/bin/env node

var url = require('url');
var child_process = require('child_process');
var util = require('util');

subcommands = {
  '--help': { help: true },
  'run': { exec: 'mongo', db: ["DB"] },
  'dump': { exec: 'mongodump', db: ["--db", "DB"] },
  'restore': { exec: 'mongorestore', db: ["--db", "DB"] },
  'import': { exec: 'mongoimport', db: ["--db", "DB"] },
  'export': { exec: 'mongoexport', db: ["--db", "DB"] },
  'files': { exec: 'mongofiles', db: ["--db", "DB"] },
  'oplog': { exec: 'mongooplog', db: ["--db", "DB"] },
  'stat': { exec: 'mongostat', db: [] },
  'top': { exec: 'mongotop', db: [] }
};

function main() {
  args = parseArgs(process.argv.slice(2));

  if (args.command.help)
    printUsageAndExit();

  var mUrl = getMeteorMongoUrl(args.site);
  var urlObj = url.parse(mUrl);
  var newArgs = buildArgs (args.command, args.commandArgs, urlObj);

  if (args.dryRun) {
    var fullCommand = shellQuote([args.command.exec].concat(newArgs));
    console.log(fullCommand);
    // console.log([args.command.exec].concat(newArgs));
  } else {
    child_process.spawn(args.command.exec, newArgs, { stdio: 'inherit' });
  }
}

function parseArgs(args) {
  parsedArgs = {};

  // 1. Flags to mmongo

  if (args[0] === '--dry') {
    parsedArgs.dryRun = true;
    args.shift();
  }

  // 2. A site is specified unless we go directly to the command

  if (!(args[0] in subcommands) && args.length > 0) {
    parsedArgs.site = args[0];
    args.shift();
  } else {
{'fraction_non_alphanumeric': 0.22478386167146974, 'fraction_numerical': 0.005123278898495036, 'mean_word_length': 3.475644699140401, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1711024', 'n_tokens_mistral': 1179, 'n_tokens_neox': 1148, 'n_words': 270}