Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/args/index.ts

Extensible CLI arguments parser for Deno with intelligent TypeScript inference
Go to Latest
import * as args from "https://deno.land/x/args@2.0.7/index.ts";

Classes

Class of error created by CommandType::extract

FlagError class for when two or more aliases of the same option being specified

Base class of all FlagError

FlagError class for when required flags not being specified

FlagError class for when an option flag being specified without a value

FlagError class for when a flag being place where a value is expected

FlagError class for when unknown flags being detected in argument list

FlagError class for when an argument fails to convert to a value

ValueError class for when raw input not matching any expected choice

ValueError class for when non-integer raw input being place in where an integer is expected

ValueError class for when non-number raw input being place in where a number is expected

Base class of all ValueError

Variables

Starting point of parser construction pipeline

Starting point of a command parser construction chain

Assign description to a command parser during construction chain

Add a flag parser on top of existing command parser

Merge two command parsers

Create a failure for Command::extract

Declare add subcommand to existing command parser

Starting point of parser construction pipeline

Declare a binary flag:

  • value is true if the flag is found in argument list once or multiple times
  • value is false if the flag isn't found in argument list

Declare an option that collects value after flags

Declare a count flag: Value is number of occurrences

Set filter option to this value make DrainOption consumes all including flags

Set filter option to this value to make DrainOption only consumes all until flags

Declare an option that drains all arguments after the flag

Declare a flag that terminates the program

Declare a binary flag:

  • value is true if the flag is found in argument list once or multiple times
  • value is false if the flag isn't found in argument list

Declare an option, including:

  • A flag
  • A value right after the flag

Turn an option partial:

  • If the option does not have a value, return default value
  • If the option has a value, return that value

Declare a partial option:

  • If a value is found, return that value
  • If not, return default value

Value of tag when argv is a complete and list of valid options

Value of tag when argv is failed to parse

Type and parser of all number values except NaN and Infinity

Type and parser of all BigInt values

Type and parser of text (string) value

Functions

Create type and parser of choice (union)

Interfaces

Interface of a command parser

Interface of component of help message of command parser

Interface of parsing failure

Interface of a main command variant

Interface of a sub command variant

Interface of descriptor of CollectOption

Interface of descriptor of DrainOption

Type of return value of DrainOptionFilterFunc

Type of while of descriptor of DrainOption

Interface of descriptor of EarlyExitFlag

Interface of descriptor of BinaryFlag and CountFlag

Interface of descriptor of Option

Interface of descriptor of PartialOption

Double dash variant of ArgvItem

Multiple flag variant of ArgvItem

Single flag variant of ArgvItem

Value variant of ArgvItem

Failure variant of Result

Interface of a help item

Interface of a flag type

Success variant of Result

Basic interface of an error

Interface of a value type

Type Aliases

Success variant of Command::extract

Type of value of FlaggedCommand

Type of value of MergeCommand

Failure variant of Command::extract

Type of value of SubCommand

Type of a classified argument

Type of result of a function that may fail