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
Latest
import * as args from "https://deno.land/x/args@2.1.1/index.ts";

Classes

Class of error created by CommandType::extract

Class of error created by CommandType::extract

c
FlagError
abstract

Base class of all FlagError

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

c
ValueError
abstract

Base class of all ValueError

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

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

Starting point of a command parser construction chain

Declare an option that collects value after flags

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

Declare a count flag: Value is number of occurrences

Starting point of parser construction pipeline

Assign description to a command parser during construction chain

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

Type and parser of all number values except NaN and Infinity

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

Add a flag parser on top of existing command parser

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

Type and parser of all BigInt values

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

Merge two command parsers

Declare an option, including:

  • A flag
  • A value right after the flag

Value of tag when argv is failed to parse

Create a failure for Command::extract

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

Declare add subcommand to existing command parser

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 text (string) value

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)

Create type and parser of choice (union)

Interfaces

Double dash variant of ArgvItem

Multiple flag variant of ArgvItem

Single flag variant of ArgvItem

Value variant of ArgvItem

Interface of descriptor of CollectOption

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 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 DrainOption

Type of return value of DrainOptionFilterFunc

Type of while of descriptor of DrainOption

Interface of descriptor of EarlyExitFlag

Failure variant of Result

Interface of descriptor of BinaryFlag and CountFlag

Interface of a help item

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

Interface of a flag type

Success variant of Result

Interface of descriptor of Option

Basic interface of an error

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

Interface of a value type

Type Aliases

Type of a classified argument

Success variant of Command::extract

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 value of FlaggedCommand

Type of value of MergeCommand

Failure variant of Command::extract

Type of result of a function that may fail

Type of value of SubCommand

Type of a classified argument

Type of result of a function that may fail