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.4.2 to 2.4.3

29

lib/index.d.ts

@@ -49,2 +49,3 @@ /// <reference types="node" />

// @ts-ignore
// @ts-ignore
declare const reducers: {

@@ -360,3 +361,3 @@ setCandidateUsage: (state: RunState, segment: string, usage: string) => {

};
type MiniCli<Context extends BaseContext> = {
type CliOptions$0 = Readonly<{
/**

@@ -367,3 +368,3 @@ * The label of the binary.

*/
readonly binaryLabel?: string;
binaryLabel?: string;
/**

@@ -374,3 +375,3 @@ * The name of the binary.

*/
readonly binaryName: string;
binaryName: string;
/**

@@ -381,4 +382,13 @@ * The version of the binary.

*/
readonly binaryVersion?: string;
binaryVersion?: string;
/**
* If `true`, the Cli will use colors in the output.
*
* @default
* process.env.FORCE_COLOR ?? process.stdout.isTTY
*/
enableColors: boolean;
}>;
type MiniCli<Context extends BaseContext> = CliOptions$0 & {
/**
* Returns an Array representing the definitions of all registered commands.

@@ -451,9 +461,4 @@ */

*/
static from<Context extends BaseContext = BaseContext>(commandClasses: CommandClass<Context>[]): Cli<Context>;
constructor({ binaryLabel, binaryName: binaryNameOpt, binaryVersion, enableColors }?: {
binaryLabel?: string;
binaryName?: string;
binaryVersion?: string;
enableColors?: boolean;
});
from<Context extends BaseContext = BaseContext>(commandClasses: CommandClass<Context>[], options?: Partial<CliOptions$0>): Cli<Context>;
constructor({ binaryLabel, binaryName: binaryNameOpt, binaryVersion, enableColors }?: Partial<CliOptions$0>);
/**

@@ -728,2 +733,2 @@ * Registers a command inside the CLI.

}
export { Command, BaseContext, Cli, CommandClass, Usage, Definition, Schema, UsageError };
export { Command, BaseContext, Cli, CliOptions$0 as CliOptions, CommandClass, Usage, Definition, Schema, UsageError };

@@ -1087,2 +1087,3 @@ 'use strict';

const command = new HelpCommand$1(realCli, contexts);
command.path = state.path;
for (const opt of state.options) {

@@ -1150,4 +1151,4 @@ switch (opt.name) {

*/
static from(commandClasses) {
const cli = new Cli();
static from(commandClasses, options = {}) {
const cli = new Cli(options);
for (const commandClass of commandClasses)

@@ -1213,2 +1214,3 @@ cli.register(commandClass);

binaryVersion: this.binaryVersion,
enableColors: this.enableColors,
definitions: () => this.definitions(),

@@ -1215,0 +1217,0 @@ error: (error, opts) => this.error(error, opts),

{
"name": "clipanion",
"version": "2.4.2",
"version": "2.4.3",
"main": "lib/index",

@@ -30,3 +30,4 @@ "license": "MIT",

"postpack": "rm -rf lib",
"test": "FORCE_COLOR=1 mocha --require ts-node/register --extension ts tests"
"test": "FORCE_COLOR=1 mocha --require ts-node/register --extension ts tests",
"demo": "node --require ts-node/register sources/demos/advanced.ts"
},

@@ -33,0 +34,0 @@ "publishConfig": {

@@ -38,2 +38,3 @@ # <img src="./logo.svg" height="25" /> Clipanion

// greet [-v,--verbose] [--name ARG]
class GreetCommand extends Command {

@@ -56,2 +57,3 @@ @Command.Boolean(`-v,--verbose`)

// fibo <a> <b>
class FibonacciCommand extends Command {

@@ -126,11 +128,15 @@ @Command.String({required: true})

#### `@Command.String({required?: boolean, tolerateBoolean?: boolean})`
#### `@Command.String({required?: boolean})`
Specifies that the command accepts a positional argument. By default it will be required, but this can be toggled off.
Specifies that the command accepts a positional argument. By default it will be required, but this can be toggled off. Note that Clipanion supports required positional arguments both at the beginning and the end of the positional argument list (which allows you to build CLI for things like `cp`).
`tolerateBoolean` specifies that the command will act like a boolean flag if it doesn't have a value. With this option on, an argument value can only be specified using `=`. It is off by default.
#### `@Command.String(optionNames: string, {tolerateBoolean?: boolean})`
Specifies that the command accepts an option that takes an argument. Arguments can be specified on the command line using either `--foo=ARG` or `--foo ARG`. Because of this, options that accept an argument must, by default, receive one on the CLI (ie `--foo --bar` wouldn't be valid if `--foo` accepts an argument).
This behaviour can be toggled off if the `tolerateBoolean` option is set. In this case, the option will act like a boolean flag if it doesn't have a value. Note that with this option on, arguments values can only be specified using the `--foo=ARG` syntax.
```ts
class RunCommand extends Command {
@Command.String(`--inspect`, { tolerateBoolean: true })
@Command.String(`--inspect`, {tolerateBoolean: true})
public debug: boolean | string = false;

@@ -150,6 +156,3 @@ // ...

#### `@Command.String(optionNames: string)`
Specifies that the command accepts an option that takes an argument.
#### `@Command.Boolean(optionNames: string)`

@@ -176,6 +179,6 @@

`Remove a dependency from the current project`,
`yarn remove lodash`,
`$0 remove lodash`,
], [
`Remove a dependency from all workspaces at once`,
`yarn remove lodash --all`,
`$0 remove lodash --all`,
]],

@@ -182,0 +185,0 @@ });

Sorry, the diff of this file is not supported yet

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