JS: Model newer yargs command-line parsing pattern

This commit is contained in:
Rasmus Wriedt Larsen
2024-08-19 14:49:26 +02:00
parent 3448751b4c
commit d3ae4c930e
2 changed files with 3 additions and 1 deletions

View File

@@ -74,6 +74,8 @@ private class DefaultModels extends CommandLineArguments::Range {
or
// `require('commander').opt()` => `{a: ..., b: ...}`
this = commander().getMember("opts").getACall()
or
this = API::moduleImport("yargs/yargs").getReturn().getMember("argv").asSource()
}
}

View File

@@ -13,7 +13,7 @@ const yargs = require('yargs/yargs');
const { hideBin } = require('yargs/helpers');
const argv = yargs(hideBin(process.argv)).argv; // $ threat-source=commandargs
SINK(argv.foo); // $ MISSING: hasFlow
SINK(argv.foo); // $ hasFlow
// older version
// https://www.npmjs.com/package/yargs/v/7.1.2