Options
All
  • Public
  • Public/Protected
  • All
Menu

rich-commands - v2.4.0

Index

Type aliases

CommandArgument

CommandArgument: StringArgument | EmptyArgument

String or empty command argument.

CommandFlagValue

CommandFlagValue: true | string | undefined

Command flag value.

CommandFlags

CommandFlags: object

Object containing command flag values by their names.

Type declaration

CommandPart

A command argument or a command flag.

EmptyArgument

EmptyArgument: undefined

Empty command argument.

Lexeme

Lexeme: string | RegExp

A value that a parser can match.

ParseOptions

ParseOptions: ParserOptions & Partial<FlagObjectOptions>

StringArgument

StringArgument: string

String command argument.

Functions

createFlagObject

createRichArgv

createRichCommand

isArgument

  • isArgument(part: CommandPart): part is CommandArgument

isFlag

parseArgs

  • Parses the source string to a RichArgv.

    Parameters

    • source: string

      The source string.

    • Default value options: ParseOptions = {}

      Parsing and processing options. Parsing options override the default ones, if you want to disable a parsing option then you should explicitly set it to undefined.

    Returns RichArgv

parseCommand

  • Tries to parse the source string to a RichCommand.

    Parameters

    • source: string

      The source string.

    • Default value options: ParseOptions = {}

      Parsing and processing options. Parsing options override the default ones, if you want to disable a parsing option then you should explicitly set it to undefined.

    Returns RichCommand | null

    A rich command if command was parsed successfully, null otherwise.

Object literals

Const defaultFlagObjectOptions

defaultFlagObjectOptions: object

Default flag object options.

allowArrayValues

allowArrayValues: true = true

caseInsensitiveFlags

caseInsensitiveFlags: false = false

Const defaultParserOptions

defaultParserOptions: object

Default rich parser options.

emptyArgMarkers

emptyArgMarkers: string[] = ["~"]

escapeMarkers

escapeMarkers: string[] = ["\\"]

flagMarkers

flagMarkers: string[] = ["--", "-"]

flagValueMarkers

flagValueMarkers: string[] = ["="]

quotes

quotes: (string | [string, string])[] = ['"', ["(", ")"]]

restMarkers

restMarkers: string[] = ["::"]

separators

separators: string[] = [" ", "\n", "\r", "\t"]

Generated using TypeDoc