Socket
Socket
Sign inDemoInstall

clipanion

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clipanion - npm Package Compare versions

Comparing version 2.0.0-rc.11 to 2.0.0-rc.12

8

lib/advanced/Command.d.ts

@@ -52,2 +52,6 @@ import { CommandBuilder, RunState } from '../core';

/**
* Register a listener that looks for an option and its followup argument. When Clipanion detects that this argument is present, the value will be pushed into the array represented in the property.
*/
static Array(descriptor: string): <Context extends BaseContext>(prototype: Command<Context>, propertyName: string) => void;
/**
* Register a listener that takes all the positional arguments remaining and store them into the selected property.

@@ -65,2 +69,6 @@ * Note that all methods affecting positional arguments are evaluated in the definition order; don't mess with it (for example sorting your properties in ascendent order might have adverse results).

}): PropertyDecorator;
/**
* Register a listener that takes all the arguments remaining (including options and such) and store them into the selected property.
* Note that all methods affecting positional arguments are evaluated in the definition order; don't mess with it (for example sorting your properties in ascendent order might have adverse results).
*/
static Proxy(): <Context extends BaseContext>(prototype: Command<Context>, propertyName: string) => void;

@@ -67,0 +75,0 @@ /**

@@ -92,2 +92,23 @@ "use strict";

}
/**
* Register a listener that looks for an option and its followup argument. When Clipanion detects that this argument is present, the value will be pushed into the array represented in the property.
*/
static Array(descriptor) {
return (prototype, propertyName) => {
const optNames = descriptor.split(`,`);
this.registerDefinition(prototype, command => {
command.addOption({ names: optNames, arity: 1 });
});
this.registerTransformer(prototype, (state, command) => {
for (const { name, value } of state.options) {
if (optNames.includes(name)) {
// @ts-ignore: The property is meant to have been defined by the child class
command[propertyName] = command[propertyName] || [];
// @ts-ignore: The property is meant to have been defined by the child class
command[propertyName].push(value);
}
}
});
};
}
static Rest({ required = 0 } = {}) {

@@ -104,2 +125,6 @@ return (prototype, propertyName) => {

}
/**
* Register a listener that takes all the arguments remaining (including options and such) and store them into the selected property.
* Note that all methods affecting positional arguments are evaluated in the definition order; don't mess with it (for example sorting your properties in ascendent order might have adverse results).
*/
static Proxy() {

@@ -106,0 +131,0 @@ return (prototype, propertyName) => {

2

package.json
{
"name": "clipanion",
"version": "2.0.0-rc.11",
"version": "2.0.0-rc.12",
"main": "lib/advanced",

@@ -5,0 +5,0 @@ "license": "MIT",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc