Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Command line parser, compatible with DOS style command
The name commandos is combination of command and DOS. commandos is a light-weighted command line parser which help to connect cli and Node.js application.
const commandos = require('commandos');
// -- example 1 --
// Parse the command line of current process with default settings.
const options = commandos.parse();
// -- example 2 --
// Parse command line with default settings.
const cmdline = 'foo -v 1.0 --name JACK';
const options = commandos.parse(cmdline);
// -- example 3 --
// Parse command line with customised settings.
const cmdline = 'foo -v 1.0 --name JACK';
const settings = {
explicit: true,
options: [
'--version -v',
'--name -n' ]
};
const options = commandos.parse(cmdline, settings);
To indicate how commandos.parse actions, parameter settings may contain following attributes:
true
OPTIONALtrue
OPTIONALfalse
OPTIONALA standard definition of an option (item of optionDefinitions) SHOULD be an object or a string. It may be an object made up of following attributes:
name string
Option's formal name which will be attribute name of the returned object.
alias string | string[] OPTIONAL
assignable boolean DEFAULT true
OPTIONAL
If option is assignable, part following the dash-prefixed option name in the command line will be regarded as value of the option if the part is not another dash-prefixed option name.
caseSensitive boolean DEFAULT INHERIT OPTIONAL
If caseSensitive is true, option version
and Version
will be regarded as two different options.
multiple boolean DEFAULT false
OPTIONAL
If option is multiple, the parsed value will be an array.
nullable boolean DEFAULT true
OPTIONAL
When we say some option is NOT nullable, we mean it SHOULD NOT appear in the command line without being followed by some value.
overwrite boolean DEFAULT INHERIT OPTIONAL
If overwrite set false
, the option or its alias SHOULD NOT appear in the command line for more than one time.
required boolean DEFAULT false
OPTIONAL
If option is required, it SHOULE appear in the command line at least once.
ATTENTION:Some of previous attributes are mutexes.
If option is multiple, it SHOULD NOT be a kind of switching value at the same time. That means the option is assignable and NOT nullable, attribute nullable, assignable and overwrite will be ignored.
It can also be a string according to private syntax looks like column definition in MySQL:
// * The option is named "version", or "v" in short. The first name is formal.
// * The option SHOULD be appended with some value.
// * The option SHOULD exist.
// * The name is case-insensitive, that means "Version" and "V" are also
// acceptable.
'--version -v NOT NULL REQUIRED NOT CASE_SENSITIVE'
// * The first word is regarded as formal name of the option.
// * Alias "v" and "edition" are also acceptable.
'version alias(v, edition)'
Read unit test code for examples:
There are already many packages help you to parse command line content, in which minimist and commander are probably most famous. However, sometimes minimist is too slim while commander is too heavy. That is why I wrote commandos.
commandos = command + DOS
If commandos is not to your taste, maybe the following packages is considerable (in alphabetical order):
FAQs
Command line parser, compatible with DOS style command
The npm package commandos receives a total of 27 weekly downloads. As such, commandos popularity was classified as not popular.
We found that commandos demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.