1. subarg
parse arguments with recursive contexts
subarg
Package: subarg
Created by: substack
Last modified: Tue, 08 Nov 2022 10:41:10 GMT
Version: 1.0.0
License: MIT
Downloads: 6,385,433
Repository: https://github.com/substack/subarg

Install

npm install subarg
yarn add subarg

subarg

parse arguments with recursive contexts using
minimist

testling badge

build status

This module is useful if you need to pass arguments into a piece of code without
coordinating ahead of time with the main program, like with a plugin system.

example

 var subarg = require('subarg');
var argv = subarg(process.argv.slice(2));
console.log(argv);

Contexts are denoted with square brackets:

$ node example/show.js rawr --beep [ boop -a 3 ] -n4 --robots [ -x 8 -y 6 ]
{ _: [ 'rawr' ],
  beep: { _: [ 'boop' ], a: 3 },
  n: 4,
  robots: { _: [], x: 8, y: 6 } }

methods

 var subarg = require('subarg')

var argv = subarg(args, opts)

Parse the arguments array args, passing opts to
minimist.

An opening [ in the args array creates a new context and a ] closes a
context. Contexts may be nested.

install

With npm do:

npm install subarg

license

MIT

Dependencies

Dependencies

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code