New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

argvark

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

argvark

Intuitive command-line argument parsing for Node.js modules

  • 2.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

argvark

Intuitive command-line argument parsing for Node.js modules

Install

npm install argvark

Usage

> node some-module -p --age=123 --name="John Doe"

var argv = require('argvark');

// Simple matches:
p = argv('-p');                // '-p'

// Verbose Parameters:
age = argv(/--age=(\d+)/)      // 123
name = argv(/--name="(.+?)"/)  // 'John Doe'

Use after() when the value is separated from the param by a space:

> node some-module port 8888

argv.after('port') // 8888

Use flag() when you want a Boolean value indicating the flag presence, or when you don't want to build your own pattern just to check flags. This uses !!argv(/-\w+[FLAG]/) so it supports both standard flag formats:

> node some-module -abCD
> node some-module -a -b -C -D

argv.flag('b') // true
argv.flag('D') // true

argv.flag('X') // false

Unmatched patterns evaluate to undefined

location = argv('--location')    // undefined

Making changes

Just run npm test to make sure everything is still working. Add tests for fixes etc.

Keywords

FAQs

Package last updated on 15 May 2016

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