Skip to content

stbestichhh/stlib-args-parser

Repository files navigation

Node.js CI NPM Version MIT License Open Source Love

@stlib/argv

Table of contents

Getting started

Installation

$ yarn add @stlib/argv

Important

Node.js 18.x+ version must be installed in your OS.

Usage

Object type for arguments

OptionsType {
  [key: string]: string;
}
// Parses arhuments and return object
function parseArgs(argv: string[]): OptionsType;

// Object with parsed arguments
const options: OptionsType;

Example

$ yarn ts-node index.ts -a --b -c=1 --d= 2 --e=smth=3 -f 4
import { options } from '@stlib/argv';

console.log(options);

// Output: { a: true, b: true, c: '1', d: '2', e: 'smth=3', f: '4' }

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Changelog

Project changes are writen in changelog, see the CHANGELOG.md.

We use SemVer for versioning. For the versions available, see the tags on this repository. For the versions supported, see the SECURITY.md.

Authors

License

This project is licensed under the MIT License - see the LICENSE.md