Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@boost/args

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@boost/args

A convention based argument parsing and formatting library, with strict validation checks.

  • 2.0.0-alpha.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
35K
decreased by-22.84%
Maintainers
1
Weekly downloads
 
Created
Source

Args - Boost

Build Status npm version npm deps

A convention based argument parsing and formatting library, with strict validation checks. It is not a command line interface.

import { parse } from '@boost/args';

interface Options {
  help: boolean;
  logLevel: 'info' | 'error' | 'warn';
  version: boolean;
}

const { command, errors, options, params, rest } = parse<Options>(process.argv.slice(2), {
  commands: ['build', 'install', 'update'],
  options: {
    help: {
      default: false,
      description: 'Show a help menu',
      type: 'boolean',
      short: 'H',
    },
    logLevel: {
      choices: ['info', 'error', 'warn'],
      default: 'info',
      description: 'Customize logging level',
    },
    version: {
      default: false,
      description: 'Show the version number',
      type: 'boolean',
      short: 'V',
    },
  },
});

Features

  • Commands and sub-commands: cmd, cmd:sub
  • Options (long and short) that set a value(s): --foo value, --foo=value, -f value, -f=value
    • Camel (preferred) or kebab cased option names.
  • Flags (boolean options) that take no value: --bar, -B
    • With implicit negation support: --no-bar
  • Parameters that act as standalone values: foo bar baz
    • Can be marked as required.
  • Rest arguments that are passed to subsequent scripts (aggregated after --): foo -- bar
  • Supports string, number, boolean, and list based values, with the addition of:
    • Single value based on a list of possible choices.
    • Multiple values with optional arity count requirements.
  • Group multiple short options under a single argument: -fBp
    • Increment a counter each time a short option is found in a group.
  • Strict parser and validation checks, allowing for informative interfaces.
    • Custom option and param validation for increased accuracy.

Installation

yarn add @boost/args

Documentation

https://milesj.gitbook.io/boost/args

Keywords

FAQs

Package last updated on 04 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc