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.
commist
Advanced tools
Readme
Build command line application with multiple commands the easy way. To be used with minimist.
'use strict'
const program = require('commist')()
const result = program
.register('abcd', function(args) {
console.log('just do', args)
})
.register({ command: 'restore', equals: true }, function(args) {
console.log('restore', args)
})
.register('args', function(args) {
args = minimist(args)
console.log('just do', args)
})
.register('abcde code', function(args) {
console.log('doing something', args)
})
.register('another command', function(args) {
console.log('anothering', args)
})
.parse(process.argv.splice(2))
if (result) {
console.log('no command called, args', result)
}
To handle async
operations, use parseAsync
instead,
which let you await on registered commands execution.
'use strict'
const program = require('commist')()
const result = await program
.register('abcd', async function(args) {
await executeCommand(args)
await doOtherStuff()
})
.parseAsync(process.argv.splice(2))
if (result) {
console.log('no command called, args', result)
}
When calling commist programs, you can abbreviate down to three char words. In the above example, these are valid commands:
node example.js abc
node example.js abc cod
node example.js anot comm
Moreover, little spelling mistakes are corrected too:
node example.js abcs cod
If you want that the command must be strict equals, you can register the command with the json configuration:
program.register({ command: 'restore', strict: true }, function(args) {
console.log('restore', args)
})
If you want to limit the maximum levenshtein distance of your commands,
you can use maxDistance: 2
:
const program = require('commist')()
const minimist = require('minimist')
const result = program
.register('abcd', function(args) {
console.log('just do', args)
})
.register({ command: 'restore', equals: true }, function(args) {
console.log('restore', args)
})
.register('args', function(args) {
args = minimist(args)
console.log('just do', args)
})
.register('abcde code', function(args) {
console.log('doing something', args)
})
.register('another command', function(args) {
console.log('anothering', args)
})
.parse(process.argv.splice(2))
if (result) {
console.log('no command called, args', result)
}
MIT
FAQs
Build your commands on minimist!
The npm package commist receives a total of 848,353 weekly downloads. As such, commist popularity was classified as popular.
We found that commist 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.
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.