Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
@jill64/ts-cli
Advanced tools
Readme
> Solidly-Typed CLI Router
npm i @jill64/ts-cli
import { App } from '@jill64/ts-cli'
new App(
{
args: [
['arg1', 'Argument 1'],
['arg2', 'Argument 2'],
['arg3', 'Argument 3']
],
options: {
verbose: {
alias: 'V',
description: 'Verbose output'
},
host: {
alias: 'h',
description: 'Host name',
type: 'string'
}
},
optional: [
['optional-1', 'Optional Argument 1'],
['optional-2', 'Optional Argument 2'],
['optional-3', 'Optional Argument 3']
],
rest: {
placeholder: 'rest-argument',
description: 'Rest Argument'
},
codes: {
0: success,
1: failure
}
},
({ args, options, optional, rest }) => {
// `<command> <arg1> <arg2> <arg3> [options] [optional1?] [optional2?] [optional3?] <...rest>`
options.verbose // boolean
options.host // string
// Allow 0 or 1 or void
return 0
}
)
The add
function defines a route.
import { App } from '@jill64/ts-cli'
new App(/* ... */)
.add(
'test',
{
// Config
},
() => {
// `<command> test`
// ...
}
)
.add(
'test start',
{
// Config
},
() => {
// `<command> test start`
// ...
}
)
The run
function executes the command immediately using process.argv
.
import { App } from '@jill64/ts-cli'
import process from 'node:process'
new App(/* ... */).run(process.argv)
// index.js
import { App } from '@jill64/ts-cli'
export const command = new App(/* ... */).add(/* ... */).add(/* ... */)
import { command } from 'index.js'
// `example`
command.execute({
args: {
arg1: 'value1',
arg2: 'value2',
arg3: 'value3'
},
optional: {
'optional-1': 'optional-value1',
'optional-2': 'optional-value2',
'optional-3': 'optional-value3'
},
// or
// rest: ['rest1', 'rest2', 'rest3'],
options: {
verbose: true,
host: 'example.com'
}
})
// `example test`
command.invoke.test({
// ...
})
// `example test start`
command.invoke['test start']({
// ...
})
FAQs
> Solidly-Typed CLI Router
We found that @jill64/ts-cli 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.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.