UNPKG

bonsai-analyzer

Version:
50 lines (43 loc) 1.32 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = getParser; var _package = _interopRequireDefault(require("../../package.json")); var _argparse = require("argparse"); function addChunkSizesArgs(parser) { parser.addArgument(['stats-file'], { action: 'store', help: `The stats file to read and calculate chunk-sizes for.` }); } function addChunkSizesDiffArgs(parser) { parser.addArgument(['file-a'], { action: 'store', help: `The first stats file to read and calculate chunk-sizes for.` }); parser.addArgument(['file-b'], { action: 'store', help: `The second stats file to read and calculate chunk-sizes for.` }); } function getParser() { const parser = new _argparse.ArgumentParser({ addHelp: true, version: _package.default.version }); const subparsers = parser.addSubparsers({ title: 'Commands', dest: 'command' }); addChunkSizesArgs(subparsers.addParser('chunk-sizes', { help: 'Calculate the total size for each chunk', addHelp: true })); addChunkSizesDiffArgs(subparsers.addParser('chunk-sizes-diff', { help: 'Diff the chunk sizes between two stats files', addHelp: true })); return parser; }