Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Readme
require('fncli')(
// Pass a main function. Parameters become arguments or options
function (name, {greeting="Hello", shout=false}) {
}
);
This would result in the following interface:
usage: script [options] name
options:
--greeting=<value>
--shout
require('fncli')({
// Pass an object with functions. Function names become
// subcommands.
hello(name, {greeting="Hello", shout=false}) {
},
goodbye({shout=false}) {
}
});
Single-letter options become short options. Aliases use ES6 syntax for assigning to new variable names.
In this example, the -s
option and --shout
are aliases.
require('fncli')(
function (// Description of command
name, // Description of name
{
greeting="Hello", // Description of greeting
s: shout=false
}) {
// Use `shout` in here
}
);
Rest parameters allow zero or more arguments to be passed.
require('fncli')(
function (
...names,
) {
}
);
Descriptions of commands, arguments and options can be accomplished using comments.
require('fncli')(
function (// Description of command
name, // Description of name
{
greeting="Hello", // Description of greeting
shout=false
}) {
}
);
This would result in the following interface:
error: Missing required argument
usage: script [options] name
Description of command
args:
name Description of name
options:
--greeting=<value> Description of greeting
--shout=<value>
Throwing "error:" messages will show usage and the error.
require('fncli')(
function (
...names, // At least one
) {
if (names.length < 1) {
throw "error: pass at least one name";
}
}
);
The fncli
function accepts an object as an optional second parameter, with:
argv
to process that instead of process.argv
.help: true
to add a --help
option that prints the usage.NB: help
is likely to default to true in the future.
An argument of -- is skipped, and following arguments are not treated as options.
Until -- is seen, options are allowed after arguments. Eg, passing foo bar -x
will set an x
option to true
, or be an error if there is no -x
option.
FAQs
cli framework using function signatures
The npm package fncli receives a total of 11 weekly downloads. As such, fncli popularity was classified as not popular.
We found that fncli 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.