UNPKG

@ts-nameof/scripts-common

Version:

ts-nameof - Common scripts for ts-nameof packages.

27 lines (26 loc) 924 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var ArgsChecker = (function () { function ArgsChecker(args) { this.args = args || process.argv.slice(2); this.originalArgs = this.args.slice(); } ArgsChecker.prototype.checkHasArg = function (argName) { if (this.originalArgs.length === 0) return true; return this.checkHasExplicitArg(argName); }; ArgsChecker.prototype.checkHasExplicitArg = function (argName) { var index = this.args.indexOf(argName); if (index === -1) return false; this.args.splice(index, 1); return true; }; ArgsChecker.prototype.verifyArgsUsed = function () { if (this.args.length > 0) console.error("Unknown args: " + this.args.join(", ")); }; return ArgsChecker; }()); exports.ArgsChecker = ArgsChecker;