Unopinionated, no-frills CLI argument parser for Node.js applications
Overall
score
99%
A command-line tool that parses numeric configuration values from command-line arguments. The tool should support various numeric inputs including integers, decimals, and negative numbers.
--port 8080, the parser returns { port: 8080, _: [] } @test--port=3000, the parser returns { port: 3000, _: [] } @test--timeout 2.5, the parser returns { timeout: 2.5, _: [] } @test--timeout=1.75, the parser returns { timeout: 1.75, _: [] } @test--temperature -5, the parser returns { temperature: -5, _: [] } @test--temperature=-15.5, the parser returns { temperature: -15.5, _: [] } @test--port 8080 --timeout 2.5 --temperature -5, the parser returns { port: 8080, timeout: 2.5, temperature: -5, _: [] } @test@generates
/**
* Parses command-line arguments and returns an object containing numeric configuration values.
*
* @param {string[]} args - Array of command-line arguments to parse
* @returns {Object} Parsed result with numeric properties and a '_' array for positional arguments
*/
function parseConfig(args) {
// IMPLEMENTATION HERE
}
module.exports = { parseConfig };Provides command-line argument parsing support.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-argdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10