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.
command-interface
Advanced tools
Readme
Build powerful command-line interfaces from simple ES6 modules.
Each command is defined within an ES module like so:
// commands/foo.cmd.js
export const name = 'foo';
export const description = 'A thing that does something.';
export const alias = 'f'; // String or Array.
export const group = 'Utilities';
export const args = {
'param1': 'the first parameter',
'param2': 'the second param',
'--foo': 'a boolean flag',
};
export const validate = (args) => args;
export default (args) {
// Run the command.
};
All exports are optional. If a name
is omitted the name of the module is assumed. The only thing you really need is the default export
function to invoke when the command is run.
If you don't wish to export the command as a default export, your can export a function named cmd
, eg:
export async function cmd(args) {
// Run the command.
}
To initialize the CLI, from the entry point of your module pass a glob pattern representing your JS modules that are commands. Typically these have a .cmd.js
suffix:
import command from 'command-interface';
command('./**/*.cmd.js');
This will load all modules with the .cmd.js
suffix anywhere within the project and produce the following index list when run with no command argument:
To get details on a specific command:
node . foo -h
node . foo param1 flag=123 -f
The parameter and option arguments are passed to the command function as the args
parameter.
{
args: ['param1'],
options: { flag: 123, f: true },
}
See minimist for more.
cd lib/examples
node .
npm test
msync - A powerful toolkit for building and syncing multiple node-modules in a flexibly defined workspace.
new-file - Simple file templates.
FAQs
Build powerful command-line interfaces from simple ES6 modules.
The npm package command-interface receives a total of 96 weekly downloads. As such, command-interface popularity was classified as not popular.
We found that command-interface 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
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.