Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Command line arguments parser and t3st example project.
Example command line input:
node your-node-app hello -a -ab -d world
In your-node-app:
const clia = require('clia')
const conf = clia(process.argv.slice(2))
// test in your browser on: https://npm.runkit.com/clia
// const conf = clia('hello -a -ab -d world'.split(' '))
conf === {
// arguments before any options
plain: [ 'hello' ],
// options saved in opt (eg. --a -bd)
opt: { a: true, b: true, d: true },
// arguments after options are tagged with the last option (eg -d world, or --d world)
// argument --key=value also saved in args, eg --d=world
args: { d: [ 'world' ] },
// the first value of each args property, so that you can use arg.prop instead of args.prop[0]
arg: { d: 'world' },
}
Empty or non-string inputs are ignored. Spaces are trimmed from inputs.
When --
is encountered, it is ignored. All subsequent inputs are treated as arguments even if they start with -
.
An error is thrown when:
__proto__
to prevent prototype pollution--store=
or --=pet
clia('run -o yaml --d=/usr/bin --fruit=mango'.split(' ')
, ['output', 'directory', 'fruit'])
yields
{
arg: {
o: 'yaml', output: 'yaml',
d: '/usr/bin', directory: '/usr/bin',
fruit: 'mango'
},
args: {
o: ['yaml'], output: ['yaml'],
d: ['/usr/bin'], directory: ['/usr/bin'],
// note key-value doesn't set option
// even when kv/value matches alias
fruit: ['mango']
},
// note key-value doesn't set opt
// even when kv/value is short option that has an alias
opt: { o: true, output: true },
plain: ['run']
}
2020.8.10
FAQs
Command line arguments parser
The npm package clia receives a total of 1 weekly downloads. As such, clia popularity was classified as not popular.
We found that clia demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.