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

x/args/flag-types.ts

Extensible CLI arguments parser for Deno with intelligent TypeScript inference
Latest
import * as args from "https://deno.land/x/args@2.1.1/flag-types.ts";

Variables

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

Interfaces

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