How to use the InvalidOptionArgumentError function from commander
Find comprehensive JavaScript commander.InvalidOptionArgumentError code examples handpicked from public code repositorys.
GitHub: consbio/mbgl-renderer
243 244 245 246 247 248 249 250 251 252 253
}; // Provide the CLI _commander.program.version(_package.version).description('Start a server to render Mapbox GL map requests to images.').option('-p, --port <n>', 'Server port', parseInt).option('-t, --tiles <mbtiles_path>', 'Directory containing local mbtiles files to render', function (tilePath) { if (!_fs["default"].existsSync(tilePath)) { throw new _commander.InvalidOptionArgumentError("Path to mbtiles files does not exist: ".concat(tilePath)); } return tilePath; }).option('-v, --verbose', 'Enable request logging').parse(process.argv); var _program$opts = _commander.program.opts(),
+ 3 other calls in file
GitHub: openedx/paragon
![openedx profile picture](/openedx.png?size=40)
21 22 23 24 25 26 27 28 29 30
* component name, otherwise throws an error. * @param {string} value - component name */ function validateComponentName(value) { if (!/^([A-Z][a-z]*)([A-Z][a-z]*)*$/g.test(value)) { throw new InvalidOptionArgumentError('Name should match Pascal case. Example: MyComponent.'); } if (fs.existsSync(path.resolve(__dirname, `../src/${value}`))) { throw new InvalidOptionArgumentError('The component already exists.'); }
+ 3 other calls in file
137 138 139 140 141 142 143 144 145
/** @param {string} value */ function parseOptPort (value) { const num = +value; if (num < 1024 || num > 49151) { throw new program.InvalidOptionArgumentError('Port must be between 1024-49151.'); } return num; }
+ 11 other calls in file
GitHub: whitlockjc/m8-js
92 93 94 95 96 97 98 99 100 101
theme = themeOrPath } else { theme = loadM8FileAndVerify(themeOrPath) if (theme.constructor.name !== 'Theme') { throw new commander.InvalidOptionArgumentError("option '-T, --theme <path>' must be to an M8 Theme file") } } m8Text.default = clc.xterm(x256(theme.textDefault.r, theme.textDefault.g, theme.textDefault.b))
+ 39 other calls in file
13 14 15 16 17 18 19 20 21 22 23
} function validateTicker(ticker) { const key = ticker.toUpperCase(); if (QUESTIONS[0].choices.includes(key) === false) { throw new InvalidOptionArgumentError("Not a valid crypto ticker."); } return key; }
+ 91 other calls in file
GitHub: kapio-dev/strapi
49 50 51 52 53 54 55 56 57 58 59 60
throw new InvalidOptionArgumentError(`Could not parse url ${value}`); } return url; } catch (e) { throw new InvalidOptionArgumentError(`Could not parse url ${value}`); } }; /**
+ 15 other calls in file
GitHub: strapi/strapi
45 46 47 48 49 50 51 52 53 54
*/ const parseInteger = (value) => { // parseInt takes a string and a radix const parsedValue = parseInt(value, 10); if (isNaN(parsedValue)) { throw new InvalidOptionArgumentError(`Not an integer: ${value}`); } return parsedValue; };
+ 11 other calls in file
commander.Option is the most popular function in commander (1786 examples)