Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
yarn add -E argufy
argufy
will parse command line arguments to Node.js CLI programs.
The package assumes that the arguments begin from the 3rd position, i.e.,
node example.js --title "Hello World"
argufy(
config: <string, ConfigItem>,
argv?: string[],
): object
The flags from the arguments will be extracted according to the configuration object and the arguments array. If arguments array is not passed, process.argv
is used to find arguments.
import argufy from 'argufy'
const config = {
title: { short: 't', command: true },
list: { short: 'l', boolean: true },
app: 'a',
delay: 'y',
file: 'f',
wait: { short: 'w', number: true },
'no-empty': 'e',
resize: 'z',
colors: 'c',
dir: 'D',
}
const res = argufy(config, process.argv)
console.log(JSON.stringify(res, null, 2))
node example.js --title Hello_World -w 10 -l -app Argufy
# or
node example.js Hello_World -w 10 -l -app Argufy
# no support "for arguments with space"
{
"_argv": [],
"title": "Hello_World",
"list": true,
"app": "Argufy",
"wait": 10
}
The special _argv property
will be assigned to contain all unmatched arguments. For example, it can be used to pass any additional parameters through to other program.
ConfigItem
TypeThe configuration for each flag can either be a shorthand string, or an object. If it is an object, it can include the following parameters:
Property | Type | Description | Example |
---|---|---|---|
short | string | A short version of the argument. | program -t title |
boolean | boolean | Parse argument as a number. | program -n 10 |
command | boolean | Can this argument be a command, i.e., be the first argument without having to follow a flag. Sets the argument to be a string. | program command |
multiple | boolean | If command is true, should multiple words be parsed as an array of commands. Sets the argument to be an array of strings. | program command1 command2 |
(c) artdecocode 2018
FAQs
Parses Command Line Arguments To Node.JS CLI Programs, Keeps Them In Arguments.xml File To Paste Into README Documentation And Generate Google Closure Compatible Exports.
The npm package argufy receives a total of 116 weekly downloads. As such, argufy popularity was classified as not popular.
We found that argufy demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.