text: #!/usr/bin/env node
  "use strict";
  var __importDefault = (this && this.__importDefault) || function (mod) {
      return (mod && mod.__esModule) ? mod : { "default": mod };
  };
  Object.defineProperty(exports, "__esModule", { value: true });
  const fs_1 = __importDefault(require("fs"));
  const yargs_1 = __importDefault(require("yargs"));
  const _1 = require(".");
  const argv = yargs_1.default
      .usage('Usage: $0 [path]')
      .command('$0 <path>', 'Convert JUnit XML format to JSON', (yargs) => {
      yargs.options({
          p: { type: 'boolean', alias: 'pretty', describe: 'Output pretty JSON' },
          f: { type: 'string', alias: 'filter-tags', describe: 'Filter XML tag names' },
      });
      yargs.coerce('f', (str) => str.split(','));
      yargs.positional('path', {
          describe: 'JUnit XML path',
          type: 'string'
      })
          .example('$0 -p -f system-out,system-err junit.xml', 'Output pretty JSON with filter <system-out> and <system-err> tags.');
  })
      .strict()
      .argv;
  const main = async () => {
      const xmlString = fs_1.default.readFileSync(argv.path, 'utf8').toString();
      const filterSet = new Set(argv.filterTags);
      const _replacer = (key, value) => {
          if (filterSet.has(key))
              return undefined;
          return value;
      };
      const indent = (argv.pretty) ? 2 : 0;
      const replacer = (argv.filterTags && argv.filterTags.length > 0) ? _replacer : undefined;
      const output = await _1.parse(xmlString);
      console.log(JSON.stringify(output, replacer, indent));
  };
  main();
  //# sourceMappingURL=cli.js.map