
Security News
Another Round of TEA Protocol Spam Floods npm, But It’s Not a Worm
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.
clipanion-rest
Advanced tools
Type-safe CLI library with no runtime dependencies
yarn add clipanion
yarn workspaces list)-- (for example yarn dlx eslint --fix)Clipanion is used in Yarn with great success.
Check the website for our documentation: mael.dev/clipanion.
You can use clipanion-v3-codemod to migrate a Clipanion v2 codebase to v3.
Commands are declared by extending from the Command abstract base class, and more specifically by implementing its execute method which will then be called by Clipanion. Whatever exit code it returns will then be set as the exit code for the process:
class SuccessCommand extends Command {
async execute() {
return 0;
}
}
Commands can also be exposed via one or many arbitrary paths using the paths static property:
class FooCommand extends Command {
static paths = [[`foo`]];
async execute() {
this.context.stdout.write(`Foo\n`);
}
}
class BarCommand extends Command {
static paths = [[`bar`]];
async execute() {
this.context.stdout.write(`Bar\n`);
}
}
Options are defined as regular class properties, annotated by the helpers provided in the Option namespace. If you use TypeScript, all property types will then be properly inferred with no extra work required:
class HelloCommand extends Command {
// Positional option
name = Option.String();
async execute() {
this.context.stdout.write(`Hello ${this.name}!\n`);
}
}
Option arguments can be validated and coerced using the Typanion library:
class AddCommand extends Command {
a = Option.String({required: true, validator: t.isNumber()});
b = Option.String({required: true, validator: t.isNumber()});
async execute() {
this.context.stdout.write(`${this.a + this.b}\n`);
}
}
Copyright © 2019 Mael Nison
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Type-safe CLI library / framework with no runtime dependencies
We found that clipanion-rest 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
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.