
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@jackens/cli
Advanced tools
‘cli’ is lightweight command-line helper. Works in both Node.js and the browser ;)
‘cli’ is lightweight command-line helper. Works in both Node.js and the browser ;)
npm install @jackens/cli
<script type="text/javascript" src="https://cdn.rawgit.com/jackens/cli/master/cli.js"></script>
or
<script type="text/javascript" src="https://cdn.rawgit.com/jackens/cli/master/cli.min.js"></script>
or
<script type="text/javascript" src="https://unpkg.com/@jackens/cli/cli.js"></script>
or
<script type="text/javascript" src="https://unpkg.com/@jackens/cli/cli.min.js"></script>
#!/usr/bin/env node
var cli = require('@jackens/cli')
var app = cli({
versionNumber: '1.2.3', // non-config key
theAnswerToLifeTheUniverseAndEverything: 42, // another non-config key
helpPrefix: '\nUsage: app [options]\n\nOptions:\n', // optional help message prefix
helpSuffix: null, // optional help message suffix
args: process.argv.slice(2), // default args source to parse
options: [{
required: true,
long: 'integer',
short: 'i',
param: 'int',
info: 'specify option with integer param',
regexp: /^\d+$/
}, {
long: 'boolean',
short: 'b',
param: 'bool',
info: 'specify option with boolean param',
regexp: /^(true|false)$/i
}, {
long: 'path',
param: 'path',
info: 'specify path'
}, {
long: 'f', // will be removed
short: 'foobar', // will be converted to ‘f’
info: '‘f’ as ‘foobar’'
}, {
long: 'version',
short: 'v',
info: 'print app version number and exit'
}, {
long: 'help',
short: 'h',
info: 'print usage information and exit'
}],
requiredInfoPrefix: '[REQUIRED] ',
requiredInfoSuffix: ' [REQUIRED]'
})
if (app.optionsMap.version.value) {
console.log(app.versionNumber)
} else if (app.optionsMap.help.value ||
app.invalidArgs.length ||
app.invalidOptionArgs.length ||
app.invalidParamArgs.length ||
app.invalidParamOptions.length ||
app.missingRequiredOptions.length) {
console.log(app.help)
console.log('invalidArgs', app.invalidArgs)
console.log('invalidOptionArgs', app.invalidOptionArgs)
console.log('invalidParamArgs', app.invalidParamArgs)
console.log('invalidParamOptions', app.invalidParamOptions)
console.log('missingRequiredOptions', app.missingRequiredOptions)
} else {
console.log(app.optionsMap)
}
Output of console.log(app.help)
:
Usage: app [options]
Options:
-i, --integer <int> [REQUIRED] specify option with integer param [REQUIRED]
-b, --boolean <bool> specify option with boolean param
--path <path> specify path
-f ‘f’ as ‘foobar’
-v, --version print app version number and exit
-h, --help print usage information and exit
FAQs
‘cli’ is lightweight command-line helper. Works in both Node.js and the browser ;)
The npm package @jackens/cli receives a total of 0 weekly downloads. As such, @jackens/cli popularity was classified as not popular.
We found that @jackens/cli 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.