Unopinionated, no-frills CLI argument parser for Node.js applications
Overall
score
99%
A simple command-line task manager that parses user commands to create, list, and filter tasks.
Parse a command that creates a task with a title and optional priority level. The command accepts a --priority flag (or -p alias) that takes a number value and any additional arguments as the task title.
['--priority', '1', 'Review', 'pull', 'request'], returns an object with priority property set to 1 and _ property containing ['Review', 'pull', 'request'] @test['-p', '3', 'Fix', 'bug'], returns an object with priority property set to 3 and _ property containing ['Fix', 'bug'] @testParse a command that lists tasks with optional filtering. The command accepts a --completed flag (boolean) and captures any search terms as positional arguments.
['--completed', 'urgent'], returns an object with completed property set to true and _ property containing ['urgent'] @test['documentation'], returns an object with _ property containing ['documentation'] and no completed property @testParse commands that consist only of positional arguments, with no flags or options specified.
['show', 'task', '42'], returns an object with _ property containing ['show', 'task', '42'] and no other properties @test@generates
/**
* Parses command-line arguments for task management commands.
*
* @param {string[]} args - Array of command-line arguments to parse
* @returns {Object} Parsed result with named properties for options and '_' array for positional arguments
*/
function parseTaskCommand(args) {
// IMPLEMENTATION HERE
}
module.exports = { parseTaskCommand };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