
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
cli-cli-cli3
Advanced tools
Command line interface for node.js
npm install @kp/cli
import {Cli} from "@kp/cli";
const cli = new Cli();
cli.command("foo")
.action(() => {
return "Foo result";
});
cli.run(process.argv).then((res) => {
process.stdout.write(res);
}).catch((err) => {
process.stderr.write(err.message);
});
<bar>
- required argument
[bar]
- not required argument
cli.command("foo <bar1> [bar2]")
.action((options, bar1: string, bar2?: string) => {
return `Foo result, with arguments bar1=${bar1} bar2=${bar2}`;
});
Types:
cli.command("foo")
.option("bar", {
type: "string",
alias: "b"
})
.option("init", {
type: "boolean",
alias: "i"
})
.action((options) => {
const {
bar = "",
init = false
} = options;
return `Foo result, with options bar=${bar} init=${init.toString()}`;
});
cli.command("foo <bar>")
.completion("bar", () => ["value1", "value2", "value3"])
.action((options, bar: string) => {
return `Foo result, with argument bar=${bar}`;
});
cli.command("completion script")
.action(() => {
return cli.completionScript();
});
source <(your-script.js completion script)
FAQs
Command line interface for node.js
We found that cli-cli-cli3 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
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.