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

clarg

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clarg - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

test.js

7

index.js

@@ -47,3 +47,8 @@ /**

var curName = _cleanUpOptionName(current);
rtn.opts[curName] = true;
var curNameSplit = curName.split('=');
if (curNameSplit[1]) {
rtn.opts[curNameSplit[0]] = curNameSplit[1];
} else {
rtn.opts[curNameSplit[0]] = true;
}
} else {

@@ -50,0 +55,0 @@ // or set a value to it

2

package.json
{
"name": "clarg",
"version": "0.0.1",
"version": "0.0.2",
"description": "Simple command line argument parser",

@@ -5,0 +5,0 @@ "main": ".",

@@ -13,18 +13,33 @@ # clarg

No questions asked, no prescribed way of doing things. Just a simple object.
## Usage
Simply import clarg anywhere in your code and it will output an object.
You don't have to specify any options upfront, just require this module
and execute it.
It doesn't matter where in code you run it - you will always get the same result
which is really just a broken down list of arguments and options passed to the process.
It supports options specified with single dashes, double dashes and their values
after a space or an equal sign. Anything goes as long as your options come after arguments.
```
var clarg = require('clarg');
var arguments = require('clarg')();
console.log(arguments);
```
var arguments = clarg();
Running this script with
`node test.js start countdown --format=long -detach -parse=yes`
will produce something like this:
// node index.js start --debug --format long
// => {args: ['start'], opts: [{debug: true, format: 'long'}]}
```
{
args: [ 'start', 'countdown' ],
opts: [ format: 'long', detach: true, parse: 'yes' ],
raw: [ 'start', 'countdown', '--format=long', '-detach', '-parse=yes' ]
}
```
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