@types/command-line-args

  • Version 5.2.3
  • Published
  • 5.87 kB
  • No dependencies
  • MIT license

Install

npm i @types/command-line-args
yarn add @types/command-line-args
pnpm add @types/command-line-args

Overview

TypeScript definitions for command-line-args

Index

Functions

function commandLineArgs

commandLineArgs: (
optionDefinitions: commandLineArgs.OptionDefinition[],
options?: commandLineArgs.ParseOptions
) => commandLineArgs.CommandLineOptions;
  • Returns an object containing option values parsed from the command line. By default it parses the global process.argv array. Parsing is strict by default. To be more permissive, enable partial or stopAtFirstUnknown modes.

Interfaces

interface CommandLineOptions

interface CommandLineOptions {}

    index signature

    [propName: string]: any;

      interface OptionDefinition

      interface OptionDefinition {}

        property alias

        alias?: string | undefined;
        • A getopt-style short option name. Can be any single character except a digit or hyphen.

        property defaultOption

        defaultOption?: boolean | undefined;
        • Any values unaccounted for by an option definition will be set on the defaultOption. This flag is typically set on the most commonly-used option to enable more concise usage.

        property defaultValue

        defaultValue?: any;
        • An initial value for the option.

        property group

        group?: string | string[] | undefined;
        • One or more group names the option belongs to.

        property lazyMultiple

        lazyMultiple?: boolean | undefined;
        • Identical to multiple but with greedy parsing disabled.

        property multiple

        multiple?: boolean | undefined;
        • Set this flag if the option accepts multiple values. In the output, you will receive an array of values each passed through the type function.

        property name

        name: string;
        • The long option name.

        property type

        type?: ((input: string) => any) | undefined;
        • A setter function (you receive the output from this) enabling you to be specific about the type and value received. Typical values are String (the default), Number and Boolean but you can use a custom function. If no option value was set you will receive null.

        interface ParseOptions

        interface ParseOptions {}

          property argv

          argv?: string[] | undefined;
          • An array of strings which if present will be parsed instead of process.argv.

          property camelCase

          camelCase?: boolean | undefined;
          • If true, options with hypenated names (e.g. move-to) will be returned in camel-case (e.g. moveTo).

          property caseInsensitive

          caseInsensitive?: boolean | undefined;
          • If true, the case of each option name or alias parsed is insignificant. For example, --Verbose and --verbose would be parsed identically, as would the aliases -V and -v. Defaults to false.

          property partial

          partial?: boolean | undefined;
          • If true, commandLineArgs will not throw on unknown options or values, instead returning them in the _unknown property of the output.

          property stopAtFirstUnknown

          stopAtFirstUnknown?: boolean | undefined;
          • If true, commandLineArgs will not throw on unknown options or values. Instead, parsing will stop at the first unknown argument and the remaining arguments returned in the _unknown property of the output. If set, partial: true is implied.

          Package Files (1)

          Dependencies (0)

          No dependencies.

          Dev Dependencies (0)

          No dev dependencies.

          Peer Dependencies (0)

          No peer dependencies.

          Badge

          To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

          You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/command-line-args.

          • Markdown
            [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/command-line-args)
          • HTML
            <a href="https://www.jsdocs.io/package/@types/command-line-args"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>