@types/minimist

  • Version 1.2.1
  • Published
  • 6.52 kB
  • No dependencies
  • MIT license

Install

npm i @types/minimist
yarn add @types/minimist
pnpm add @types/minimist

Overview

TypeScript definitions for minimist

Index

Functions

function minimist

minimist: {
(args?: string[], opts?: minimist.Opts): minimist.ParsedArgs;
<T>(args?: string[], opts?: minimist.Opts): T & minimist.ParsedArgs;
<T extends minimist.ParsedArgs>(args?: string[], opts?: minimist.Opts): T;
};
  • Return an argument object populated with the array arguments from args

    Parameter args

    An optional argument array (typically process.argv.slice(2))

    Parameter opts

    An optional options object to customize the parsing

  • Return an argument object populated with the array arguments from args. Strongly-typed to be the intersect of type T with minimist.ParsedArgs.

    T The type that will be intersected with minimist.ParsedArgs to represent the argument object

    Parameter args

    An optional argument array (typically process.argv.slice(2))

    Parameter opts

    An optional options object to customize the parsing

  • Return an argument object populated with the array arguments from args. Strongly-typed to be the the type T which should extend minimist.ParsedArgs

    T The type that extends minimist.ParsedArgs and represents the argument object

    Parameter args

    An optional argument array (typically process.argv.slice(2))

    Parameter opts

    An optional options object to customize the parsing

Interfaces

interface Opts

interface Opts {}

    property '--'

    '--'?: boolean;
    • When true, populate argv._ with everything before the -- and argv['--'] with everything after the --. Note that with -- set, parsing for arguments still stops after the --.

    property alias

    alias?: { [key: string]: string | string[] };
    • An object mapping string names to strings or arrays of string argument names to use as aliases

    property boolean

    boolean?: boolean | string | string[];
    • A boolean, string or array of strings to always treat as booleans. If true will treat all double hyphenated arguments without equals signs as boolean (e.g. affects --foo, not -f or --foo=bar)

    property default

    default?: { [key: string]: any };
    • An object mapping string argument names to default values

    property stopEarly

    stopEarly?: boolean;
    • When true, populate argv._ with everything after the first non-option

    property string

    string?: string | string[];
    • A string or array of strings argument names to always treat as strings

    property unknown

    unknown?: (arg: string) => boolean;
    • A function which is invoked with a command line parameter not defined in the opts configuration object. If the function returns false, the unknown option is not added to argv

    interface ParsedArgs

    interface ParsedArgs {}

      property '--'

      '--'?: string[];
      • If opts['--'] is true, populated with everything after the --

      index signature

      [arg: string]: any;

        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/minimist.

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