CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-arg

Unopinionated, no-frills CLI argument parser for Node.js applications

Overall
score

99%

Overview
Eval results
Files

task.mdevals/scenario-4/

Command Line Task Manager

A simple command-line task manager that parses user commands to create, list, and filter tasks.

Capabilities

Parse task creation command

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.

  • Given arguments ['--priority', '1', 'Review', 'pull', 'request'], returns an object with priority property set to 1 and _ property containing ['Review', 'pull', 'request'] @test
  • Given arguments ['-p', '3', 'Fix', 'bug'], returns an object with priority property set to 3 and _ property containing ['Fix', 'bug'] @test

Parse listing command

Parse a command that lists tasks with optional filtering. The command accepts a --completed flag (boolean) and captures any search terms as positional arguments.

  • Given arguments ['--completed', 'urgent'], returns an object with completed property set to true and _ property containing ['urgent'] @test
  • Given arguments ['documentation'], returns an object with _ property containing ['documentation'] and no completed property @test

Handle commands without options

Parse commands that consist only of positional arguments, with no flags or options specified.

  • Given arguments ['show', 'task', '42'], returns an object with _ property containing ['show', 'task', '42'] and no other properties @test

Implementation

@generates

API

/**
 * 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 };

Dependencies { .dependencies }

arg { .dependency }

Provides command-line argument parsing support.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-arg

tile.json