arg

  • Version 5.0.2
  • Published
  • 13.7 kB
  • No dependencies
  • MIT license

Install

npm i arg
yarn add arg
pnpm add arg

Overview

Unopinionated, no-frills CLI argument parser

Index

Variables

variable COUNT

const COUNT: Handler<number> & { [flagSymbol]: true };

    variable flagSymbol

    const flagSymbol: Symbol;

      Functions

      function arg

      arg: typeof arg;

        function flag

        flag: <T>(fn: T) => T & { [flagSymbol]: true };

          Classes

          class ArgError

          class ArgError extends Error {}

            constructor

            constructor(message: string, code: string);

              property code

              code: string;

                Interfaces

                interface Options

                interface Options {}

                  property argv

                  argv?: string[];

                    property permissive

                    permissive?: boolean;

                      property stopAtPositional

                      stopAtPositional?: boolean;

                        interface Spec

                        interface Spec {}

                          index signature

                          [key: string]: string | Handler | [Handler];

                            Type Aliases

                            type Handler

                            type Handler<T = any> = (value: string, name: string, previousValue?: T) => T;

                              type Result

                              type Result<T extends Spec> = { _: string[] } & {
                              [K in keyof T]?: T[K] extends Handler
                              ? ReturnType<T[K]>
                              : T[K] extends [Handler]
                              ? Array<ReturnType<T[K][0]>>
                              : never;
                              };

                                Package Files (1)

                                Dependencies (0)

                                No dependencies.

                                Dev Dependencies (3)

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

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