<commit_before>var ArgumentParser = function(argv) {
  var Cucumber = require('../../cucumber');

  var nopt = require('nopt');
  var path = require('path');
  var options;

  var self = {
    parse: function parse() {
      var knownOptionDefinitions     = self.getKnownOptionDefinitions();
      var shortenedOptionDefinitions = self.getShortenedOptionDefinitions();
      var options = nopt(knownOptionDefinitions,
                         shortenedOptionDefinitions,
                         argv,
                         ArgumentParser.NUMBER_OF_LEADING_ARGS_TO_SLICE);
      self.storeOptions(options);
    },

    getFeatureFilePaths: function getFeatureFilePaths() {
      var unexpandedFeaturePaths = self.getUnexpandedFeaturePaths();
      var expandedFeaturePaths   = ArgumentParser.FeaturePathExpander.expandPaths(unexpandedFeaturePaths);
      return expandedFeaturePaths;
    },

    getFeatureDirectoryPaths: function getFeatureDirectoryPaths() {
      var featureDirectoryPaths = [];
      var featureFilePaths      = self.getFeatureFilePaths();
      featureFilePaths.forEach(function(featureFilePath) {
        var featureDirectoryPath = featureFilePath.replace(ArgumentParser.FEATURE_FILENAME_REGEXP, '');
        featureDirectoryPaths.push(featureDirectoryPath);
      });
      return featureDirectoryPaths;
    },

    getUnexpandedFeaturePaths: function unexpandedFeaturePaths() {
      var options   = self.getOptions();
      var remaining = options['argv']['remain'];
      var paths     = (remaining.length > 0 ? remaining : [ArgumentParser.DEFAULT_FEATURES_DIRECTORY]);
      return paths;
    },

    getSupportCodeFilePaths: function getSupportCodeFilePaths() {
      var unexpandedSupportCodeFilePaths = self.getUnexpandedSupportCodeFilePaths();
      var expandedSupportCodePaths       = ArgumentParser.SupportCodePathExpander.expandPaths(unexpandedSupportCodeFilePaths);
      return expandedSupportCodePaths;
    },

    getUnexpandedSupportCodeFilePaths: function getUnexpandedSupportCodeFilePaths() {
      var unexpandedFeatureDirectoryPaths = self.getFeatureDirectoryPaths();
      var unexpandedSupportCodeFilePaths  = self.getOptionOrDefault(ArgumentParser.REQUIRE_OPTION_NAME, unexpandedFeatureDirectoryPaths);
      return unexpandedSupportCodeFilePaths;
    },

    getTagGroups: function getTagGroups() {
      var tagOptionValues = self.getOptionOrDefault(ArgumentParser.TAGS_OPTION_NAME, []);
      var tagGroups       = Cucumber.TagGroupParser.getTagGroupsFromStrings(tagOptionValues);
      return tagGroups;
    },

      getStackFormat: function getStackFormat() {
          var stackFormat = self.getOptionOrDefault(ArgumentParser.USE_SHORT_STACK_OPTION_NAME , ArgumentParser.DEFAULT_USE_SHORT_STACK_VALUE);
          return stackFormat;
      },

      getFormat: function getFormat() {
      var format = self.getOptionOrDefault(ArgumentParser.FORMAT_OPTION_NAME, ArgumentParser.DEFAULT_FORMAT_VALUE);
      return format;
    },

    getKnownOptionDefinitions: function getKnownOptionDefinitions() {
      var definitions = {};
      definitions[ArgumentParser.REQUIRE_OPTION_NAME]              = [path, Array];
      definitions[ArgumentParser.TAGS_OPTION_NAME]                 = [String, Array];
      definitions[ArgumentParser.FORMAT_OPTION_NAME]               = String;
      definitions[ArgumentParser.USE_SHORT_STACK_OPTION_NAME]      = Boolean;
      definitions[ArgumentParser.HELP_FLAG_NAME]                   = Boolean;
      definitions[ArgumentParser.VERSION_FLAG_NAME]                = Boolean;
      definitions[ArgumentParser.COFFEE_SCRIPT_SNIPPETS_FLAG_NAME] = Boolean;
      return definitions;
    },

    getShortenedOptionDefinitions: function getShortenedOptionDefinitions() {
      var definitions = {};
      definitions[ArgumentParser.REQUIRE_OPTION_SHORT_NAME] = [ArgumentParser.LONG_OPTION_PREFIX + ArgumentParser.REQUIRE_OPTION_NAME];
      definitions[ArgumentParser.FORMAT_OPTION_SHORT_NAME] = [ArgumentParser.LONG_OPTION_PREFIX + ArgumentParser.FORMAT_OPTION_NAME];
      definitions[ArgumentParser.HELP_FLAG_SHORT_NAME]      = [ArgumentParser.LONG_OPTION_PREFIX + ArgumentParser.HELP_FLAG_NAME];
      return definitions;
    },

    isHelpRequested: function isHelpRequested() {
      var isHelpRequested = self.getOptionOrDefault(ArgumentParser.HELP_FLAG_NAME, ArgumentParser.DEFAULT_HELP_FLAG_VALUE);
      return isHelpRequested;
    },

    isVersionRequested: function isVersionRequested() {
      var isVersionRequested = self.getOptionOrDefault(ArgumentParser.VERSION_FLAG_NAME, ArgumentParser.DEFAULT_VERSION_FLAG_VALUE);
      return isVersionRequested;
    },

    shouldSnippetsBeInCoffeeScript: function shouldSnippetsBeInCoffeeScript() {
      var areSnippetsInCoffeeScript = self.getOptionOrDefault(ArgumentParser.COFFEE_SCRIPT_SNIPPETS_FLAG_NAME, ArgumentParser.DEFAULT_COFFEE_SCRIPT_SNIPPETS_FLAG_VALUE);
      return areSnippetsInCoffeeScript;
    },

    storeOptions: function storeOptions(newOptions) {
      options = newOptions;
    },

    getOptions: function getOptions() {
      return options;
    },

    getOptionOrDefault: function getOptionOrDefault(optionName, defaultValue) {
      var options     = self.getOptions();
      var optionValue = options[optionName];
      return (typeof(optionValue) != 'undefined' ? optionValue : defaultValue);
    }
  };
  return self;
};
ArgumentParser.NUMBER_OF_LEADING_ARGS_TO_SLICE           = 2;
ArgumentParser.DEFAULT_FEATURES_DIRECTORY                = "features";
ArgumentParser.FEATURE_FILENAME_REGEXP                   = /[\/\\][^\/\\]+\.feature(:\d+)*$/i;
ArgumentParser.FEATURE_FILENAME_AND_LINENUM_REGEXP       = /(.*)\:(\d*)$|.*/; //fullmatch, filewithoutlinenum, linenum
ArgumentParser.LONG_OPTION_PREFIX                        = "--";
ArgumentParser.REQUIRE_OPTION_NAME                       = "require";
ArgumentParser.REQUIRE_OPTION_SHORT_NAME                 = "r";
ArgumentParser.FORMAT_OPTION_NAME                        = "format";
ArgumentParser.FORMAT_OPTION_SHORT_NAME                  = "f";
ArgumentParser.DEFAULT_FORMAT_VALUE                      = "progress";
ArgumentParser.TAGS_OPTION_NAME                          = "tags";
ArgumentParser.TAGS_OPTION_SHORT_NAME                    = "t";
ArgumentParser.USE_SHORT_STACK_OPTION_NAME               = "s";
ArgumentParser.DEFAULT_USE_SHORT_STACK_VALUE             = false;
ArgumentParser.HELP_FLAG_NAME                            = "help";
ArgumentParser.HELP_FLAG_SHORT_NAME                      = "h";
ArgumentParser.DEFAULT_HELP_FLAG_VALUE                   = false;<commit_msg>Changed command to show short stack traces from string to boolean<commit_after>var ArgumentParser = function(argv) {
  var Cucumber = require('../../cucumber');

  var nopt = require('nopt');
  var path = require('path');
  var options;

  var self = {
    parse: function parse() {
      var knownOptionDefinitions     = self.getKnownOptionDefinitions();
      var shortenedOptionDefinitions = self.getShortenedOptionDefinitions();
      var options = nopt(knownOptionDefinitions,
                         shortenedOptionDefinitions,
                         argv,
                         ArgumentParser.NUMBER_OF_LEADING_ARGS_TO_SLICE);
      self.storeOptions(options);
    },

    getFeatureFilePaths: function getFeatureFilePaths() {
      var unexpandedFeaturePaths = self.getUnexpandedFeaturePaths();
      var expandedFeaturePaths   = ArgumentParser.FeaturePathExpander.expandPaths(unexpandedFeaturePaths);
      return expandedFeaturePaths;
    },

    getFeatureDirectoryPaths: function getFeatureDirectoryPaths() {
      var featureDirectoryPaths = [];
      var featureFilePaths      = self.getFeatureFilePaths();
      featureFilePaths.forEach(function(featureFilePath) {
        var featureDirectoryPath = featureFilePath.replace(ArgumentParser.FEATURE_FILENAME_REGEXP, '');
        featureDirectoryPaths.push(featureDirectoryPath);
      });
      return featureDirectoryPaths;
    },

    getUnexpandedFeaturePaths: function unexpandedFeaturePaths() {
      var options   = self.getOptions();
      var remaining = options['argv']['remain'];
      var paths     = (remaining.length > 0 ? remaining : [ArgumentParser.DEFAULT_FEATURES_DIRECTORY]);
      return paths;
    },

    getSupportCodeFilePaths: function getSupportCodeFilePaths() {
      var unexpandedSupportCodeFilePaths = self.getUnexpandedSupportCodeFilePaths();
      var expandedSupportCodePaths       = ArgumentParser.SupportCodePathExpander.expandPaths(unexpandedSupportCodeFilePaths);
      return expandedSupportCodePaths;
    },

    getUnexpandedSupportCodeFilePaths: function getUnexpandedSupportCodeFilePaths() {
      var unexpandedFeatureDirectoryPaths = self.getFeatureDirectoryPaths();
      var unexpandedSupportCodeFilePaths  = self.getOptionOrDefault(ArgumentParser.REQUIRE_OPTION_NAME, unexpandedFeatureDirectoryPaths);
      return unexpandedSupportCodeFilePaths;
    },

    getTagGroups: function getTagGroups() {
      var tagOptionValues = self.getOptionOrDefault(ArgumentParser.TAGS_OPTION_NAME, []);
      var tagGroups       = Cucumber.TagGroupParser.getTagGroupsFromStrings(tagOptionValues);
      return tagGroups;
    },

      getStackFormat: function getStackFormat() {
          var stackFormat = self.getOptionOrDefault(ArgumentParser.USE_SHORT_STACK_OPTION_NAME , ArgumentParser.DEFAULT_USE_SHORT_STACK_VALUE);
          return stackFormat;
      },

      getFormat: function getFormat() {
      var format = self.getOptionOrDefault(ArgumentParser.FORMAT_OPTION_NAME, ArgumentParser.DEFAULT_FORMAT_VALUE);
      return format;
    },

    getKnownOptionDefinitions: function getKnownOptionDefinitions() {
      var definitions = {};
      definitions[ArgumentParser.REQUIRE_OPTION_NAME]              = [path, Array];
      definitions[ArgumentParser.TAGS_OPTION_NAME]                 = [String, Array];
      definitions[ArgumentParser.FORMAT_OPTION_NAME]               = String;
      definitions[ArgumentParser.USE_SHORT_STACK_OPTION_NAME]      = Boolean;
      definitions[ArgumentParser.HELP_FLAG_NAME]                   = Boolean;
      definitions[ArgumentParser.VERSION_FLAG_NAME]                = Boolean;
      definitions[ArgumentParser.COFFEE_SCRIPT_SNIPPETS_FLAG_NAME] = Boolean;
      return definitions;
    },

    getShortenedOptionDefinitions: function getShortenedOptionDefinitions() {
      var definitions = {};
      definitions[ArgumentParser.REQUIRE_OPTION_SHORT_NAME] = [ArgumentParser.LONG_OPTION_PREFIX + ArgumentParser.REQUIRE_OPTION_NAME];
      definitions[ArgumentParser.FORMAT_OPTION_SHORT_NAME] = [ArgumentParser.LONG_OPTION_PREFIX + ArgumentParser.FORMAT_OPTION_NAME];
      definitions[ArgumentParser.HELP_FLAG_SHORT_NAME]      = [ArgumentParser.LONG_OPTION_PREFIX + ArgumentParser.HELP_FLAG_NAME];
      return definitions;
    },

    isHelpRequested: function isHelpRequested() {
      var isHelpRequested = self.getOptionOrDefault(ArgumentParser.HELP_FLAG_NAME, ArgumentParser.DEFAULT_HELP_FLAG_VALUE);
      return isHelpRequested;
    },

    isVersionRequested: function isVersionRequested() {
      var isVersionRequested = self.getOptionOrDefault(ArgumentParser.VERSION_FLAG_NAME, ArgumentParser.DEFAULT_VERSION_FLAG_VALUE);
      return isVersionRequested;
    },

    shouldSnippetsBeInCoffeeScript: function shouldSnippetsBeInCoffeeScript() {
      var areSnippetsInCoffeeScript = self.getOptionOrDefault(ArgumentParser.COFFEE_SCRIPT_SNIPPETS_FLAG_NAME, ArgumentParser.DEFAULT_COFFEE_SCRIPT_SNIPPETS_FLAG_VALUE);
      return areSnippetsInCoffeeScript;
    },

    storeOptions: function storeOptions(newOptions) {
      options = newOptions;
    },

    getOptions: function getOptions() {
      return options;
    },

    getOptionOrDefault: function getOptionOrDefault(optionName, defaultValue) {
      var options     = self.getOptions();
      var optionValue = options[optionName];
      return (typeof(optionValue) != 'undefined' ? optionValue : defaultValue);
    }
  };
  return self;
};
ArgumentParser.NUMBER_OF_LEADING_ARGS_TO_SLICE           = 2;
ArgumentParser.DEFAULT_FEATURES_DIRECTORY                = "features";
ArgumentParser.FEATURE_FILENAME_REGEXP                   = /[\/\\][^\/\\]+\.feature(:\d+)*$/i;
ArgumentParser.FEATURE_FILENAME_AND_LINENUM_REGEXP       = /(.*)\:(\d*)$|.*/; //fullmatch, filewithoutlinenum, linenum
ArgumentParser.LONG_OPTION_PREFIX                        = "--";
ArgumentParser.REQUIRE_OPTION_NAME                       = "require";
ArgumentParser.REQUIRE_OPTION_SHORT_NAME                 = "r";
ArgumentParser.FORMAT_OPTION_NAME                        = "format";
ArgumentParser.FORMAT_OPTION_SHORT_NAME                  = "f";
ArgumentParser.DEFAULT_FORMAT_VALUE                      = "progress";
ArgumentParser.TAGS_OPTION_NAME                          = "tags";
ArgumentParser.TAGS_OPTION_SHORT_NAME                    = "t";
ArgumentParser.USE_SHORT_STACK_OPTION_NAME               = "shortStackTraces";
ArgumentParser.DEFAULT_USE_SHORT_STACK_VALUE             = false;
ArgumentParser.HELP_FLAG_NAME                            = "help";
ArgumentParser.HELP_FLAG_SHORT_NAME                      = "h";
ArgumentParser.DEFAULT_HELP_FLAG_VALUE                   = false;
{'fraction_non_alphanumeric': 0.08199804408335214, 'fraction_numerical': 0.00030091025351688857, 'mean_word_length': 3.4239600665557406, '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': '7570703', 'n_tokens_mistral': 3592, 'n_tokens_neox': 3528, 'n_words': 521}