Unopinionated, no-frills CLI argument parser for Node.js applications
Overall
score
99%
Build a command-line argument parser for a task management tool that handles various input formats and types.
@generates
Create a parser that accepts the following command-line arguments:
Task content flags:
--title: A string representing the task title (required for creating tasks)--description or --desc: A string containing task description--priority or -p: A number from 1-5 indicating task priority--tags or -t: Can be specified multiple times to add multiple tags to a taskOperation flags:
--verbose or -v: Can be specified multiple times to increase verbosity level (0-3)--list or -l: A boolean flag to list all tasks--complete or -c: A boolean flag to mark tasks as complete--help or -h: A boolean flag to show help informationParsing behavior:
['--title', 'Buy groceries', '--priority', '2'], the result contains a title string and priority number @test['-v', '-v', '-v'], the verbose flag value equals 3 @test['--tags', 'work', '--tags', 'urgent', '-t', 'important'], the tags array contains three strings @test['--desc', 'Task details'], the result contains the description under the canonical key name @test['--unknown', 'value'], an error is thrown @test/**
* Parse command-line arguments for the task manager
* @param {string[]} argv - Array of argument strings to parse
* @returns {Object} Parsed arguments with positional args in the _ property
* @throws {Error} When unknown arguments are encountered
*/
function parseTaskArgs(argv) {
// Implementation here
}
module.exports = { parseTaskArgs };Provides command-line argument parsing capabilities.
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