<commit_before>var os = require('os');
var executeCmds = require('./executeCmds.js');

if (os.platform() !== 'win32') {
  throw new Error('The script can only run on windows platform');
}

var cmds = [
  { cmd: 'chcp 850' },//to avoid https://github.com/npm/npm/issues/6438
  { cmd: 'npm install'},
  { cmd: 'npm install grunt-cli -g'},
  { cmd: 'grunt generateCode'},
];

var updatePackageVersion = process.argv[2] && (process.argv[2].indexOf('updatePackageVersion') === 0);
var removeExistingSpecPackages = process.argv[3] && (process.argv[3].indexOf('removeExistingSpecPackages') === 0);

console.log('***********');
console.log('*Info: Please make sure spec version was updated in <repository-root>\\packages.config');
if (updatePackageVersion) {
  console.log('*Info: Please make sure the version was updated in <repository-root>\\gruntfile.js');
}
console.log('*After you commit changes to remote, you can access tarball using link such as ' +
            'https://github.com/Azure/azure-sdk-for-node/tarball/dev/lib/services/computeManagement/');
console.log('***********');

if (updatePackageVersion) {
  cmds.push({ cmd: 'grunt updateVersions' });
}

if (removeExistingSpecPackages) {
  var packagesFolder = '"' + __dirname + '\\..\\packages' + '"';
  cmds.unshift({ cmd: 'if exist ' + packagesFolder + ' rmdir /s /q ' + packagesFolder });
}

executeCmds.execute(cmds);<commit_msg>improve command line argument parsing<commit_after>var os = require('os');
var executeCmds = require('./executeCmds.js');

if (os.platform() !== 'win32') {
  throw new Error('The script can only run on windows platform');
}

var cmds = [
  { cmd: 'chcp 850' },//to avoid https://github.com/npm/npm/issues/6438
  { cmd: 'npm install'},
  { cmd: 'npm install grunt-cli -g'},
  { cmd: 'grunt generateCode'},
];

var updatePackageVersion = false;
var removeExistingSpecPackages = false;

process.argv.forEach(function(v){
  if (v.indexOf('updatePackageVersion') === 0){
    updatePackageVersion = true;
  } else if (v.indexOf('removeExistingSpecPackages') === 0) {
    removeExistingSpecPackages = true; 
  } 
});

console.log('***********');
console.log('*Info: Please make sure spec version was updated in <repository-root>\\packages.config');
if (updatePackageVersion) {
  console.log('*Info: Please make sure the version was updated in <repository-root>\\gruntfile.js');
}
console.log('*After you commit changes to remote, you can access tarball using link such as ' +
            'https://github.com/Azure/azure-sdk-for-node/tarball/dev/lib/services/computeManagement/');
console.log('***********');

if (updatePackageVersion) {
  cmds.push({ cmd: 'grunt updateVersions' });
}

if (removeExistingSpecPackages) {
  var packagesFolder = '"' + __dirname + '\\..\\packages' + '"';
  cmds.unshift({ cmd: 'if exist ' + packagesFolder + ' rmdir /s /q ' + packagesFolder });
}

executeCmds.execute(cmds);
{'fraction_non_alphanumeric': 0.1825424315898857, 'fraction_numerical': 0.009005888465535157, 'mean_word_length': 4.553846153846154, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 4, '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': '3685171', 'n_tokens_mistral': 941, 'n_tokens_neox': 918, 'n_words': 229}