Socket
Socket
Sign inDemoInstall

node-argv

Package Overview
Dependencies
1
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    node-argv

Parse argv as String or process.argv


Version published
Weekly downloads
53
decreased by-11.67%
Maintainers
1
Install size
39.0 kB
Created
Weekly downloads
 

Readme

Source

node-argv

Parse argv as a String, then feed minimist and expose the interface:

{
  options: {},
  commands: [],
  through: { // only if '--' is given
    options: {},
    commands: []
  },
  input: [] // parsed argv
}

Parse String

var argv = require('node-argv')
  , options = {}; // minimist options

argv('first command --hello true -c "value" -- second command -b', {});
// return
{
  options: {
    hello: true,
    c: 'value'
  },
  commands: ['first', 'command'],
  through: {
    options: {
      b: true
    },
    commands: ['second', 'command']
  },
  input: ['first', 'command', '--hello', 'true', '-c', 'value', '--', 'second', 'command', '-b']
}

Parse Array

This module also parses an Array directly using minimist but exposing the above interface

var argv = require('node-argv');

argv(process.argv.slice(2), {});

Target

The third parameter is the optional target, if given it will be used to store the result attributes.

install

With npm do:

npm install node-argv

license

MIT

Keywords

FAQs

Last updated on 16 Jul 2014

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc