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

argumentate

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

argumentate

A simple argv parser (like so many others)

  • 3.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Argumentate

A very simple argv parser

Installation

npm install argumentate

Usage

// make executable (not required, but needed if you are building a cli with a bin file (remember to put bin in your package.json!))
#!/usr/bin/env node

// import argumentate
let argumentate = require('argumentate');

// slice to remove path args
let { options, variables } = argumentate({
	args: process.argv.slice(2),
	mapping: {
		c: 'config',
		p: {
			key: 'port',
			help: 'Port to use when launching this command'
		}
	},
	config: {
		name: 'My CLI',
		command: 'invoke-like-this'
	}
);

// be happy

Mappings

 const { options, variables } = argumentate({
 	args: ['start', '-p=8080', '-c', './myconfig.json'],
 	mapping: {
	 	c: 'config',
		p: {
			key: 'port',
			help: 'Port to use when launching this command'
		}
 	}
 );

// returns
{ 
	options: {
		port: '8080',
		config: './myconfig.json'
	},
	variables: ['start']
}

Keywords

FAQs

Package last updated on 27 Mar 2022

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