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 3.0.0-rc.6 to 3.0.0-rc.7

3

lib/advanced/Cli.js

@@ -231,3 +231,3 @@ 'use strict';

result += `\n`;
result += format.formatMarkdownish(`You can also print more details about any of these commands by calling them after adding the \`-h,--help\` flag right after the command name.`, { format: this.format(colored), paragraphs: true });
result += format.formatMarkdownish(`You can also print more details about any of these commands by calling them with the \`-h,--help\` flag right after the command name.`, { format: this.format(colored), paragraphs: true });
}

@@ -293,3 +293,2 @@ else {

result += `${this.format(colored).error(name)}: ${error.message}\n`;
// @ts-ignore
const meta = error.clipanion;

@@ -296,0 +295,0 @@ if (typeof meta !== `undefined`) {

export { Command } from './Command';
export { BaseContext, Cli, CliOptions } from './Cli';
export { CommandClass, Usage, Definition } from './Command';
export { UsageError } from '../errors';
export { UsageError, ErrorMeta, ErrorWithMeta } from '../errors';
export * as Builtins from './builtins';
export * as Option from './options';

@@ -48,4 +48,4 @@ import { StrictValidator } from "typanion";

export declare function String<T = string, Arity extends number = 1>(descriptor: string, opts?: StringOptionNoBoolean<T, Arity>): CommandOptionReturn<WithArity<T, Arity> | undefined>;
export declare function String<T = string>(descriptor: string, opts?: StringOptionTolerateBoolean<T>): CommandOptionReturn<T | boolean | undefined>;
export declare function String<T = string>(descriptor: string, initialValue: string | boolean, opts?: Omit<StringOptionTolerateBoolean<T>, 'required'>): CommandOptionReturn<T | boolean>;
export declare function String<T = string>(descriptor: string, opts: StringOptionTolerateBoolean<T>): CommandOptionReturn<T | boolean | undefined>;
export declare function String<T = string>(descriptor: string, initialValue: string | boolean, opts: Omit<StringOptionTolerateBoolean<T>, 'required'>): CommandOptionReturn<T | boolean>;
export declare function String<T = string, Arity extends number = 1>(descriptor: string, initialValue: WithArity<string, Arity>, opts?: Omit<StringOptionNoBoolean<T, Arity>, 'required'>): CommandOptionReturn<WithArity<T, Arity>>;

@@ -32,5 +32,8 @@ 'use strict';

}
if (typeof initialValue === `undefined` && typeof currentValue === `undefined`)
return undefined;
return utils.applyValidator(usedName !== null && usedName !== void 0 ? usedName : key, currentValue, opts.validator);
if (typeof currentValue === `string`) {
return utils.applyValidator(usedName !== null && usedName !== void 0 ? usedName : key, currentValue, opts.validator);
}
else {
return currentValue;
}
},

@@ -37,0 +40,0 @@ });

@@ -7,2 +7,22 @@ export declare type ErrorMeta = {

/**
* An error with metadata telling clipanion how to print it
*
* Errors with this metadata property will have their name and message printed, but not the
* stacktrace.
*
* This should be used for errors where the message is the part that's important but the stacktrace is useless.
* Some examples of where this might be useful are:
*
* - Invalid input by the user (see `UsageError`)
* - A HTTP connection fails, the user is shown "Failed To Fetch Data: Could not connect to server example.com" without stacktrace
* - A command in which the user enters credentials doesn't want to show a stacktract when the user enters invalid credentials
* - ...
*/
export interface ErrorWithMeta extends Error {
/**
* Metadata detailing how clipanion should print this error
*/
readonly clipanion: ErrorMeta;
}
/**
* A generic usage error with the name `UsageError`.

@@ -9,0 +29,0 @@ *

@@ -51,3 +51,3 @@ 'use strict';

this.name = `AmbiguousSyntaxError`;
this.message = `Cannot find who to pick amongst the following alternatives:\n\n${this.usages.map((usage, index) => {
this.message = `Cannot find which to pick amongst the following alternatives:\n\n${this.usages.map((usage, index) => {
return `${`${index}.`.padStart(4)} ${usage}`;

@@ -54,0 +54,0 @@ }).join(`\n`)}\n\n${whileRunning(input)}`;

{
"name": "clipanion",
"version": "3.0.0-rc.6",
"version": "3.0.0-rc.7",
"main": "lib/advanced/index",

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

@@ -5,7 +5,7 @@ # <img src="./logo.svg" height="25" /> Clipanion

[![](https://img.shields.io/npm/v/clipanion.svg)]() [![](https://img.shields.io/npm/l/clipanion.svg)]() [![](https://img.shields.io/badge/developed%20with-Yarn%202-blue)](https://github.com/yarnpkg/berry)
[![npm version](https://img.shields.io/npm/v/clipanion.svg)](https://yarnpkg.com/package/clipanion) [![Licence](https://img.shields.io/npm/l/clipanion.svg)](https://github.com/arcanis/clipanion#license-mit) [![Yarn](https://img.shields.io/badge/developed%20with-Yarn%202-blue)](https://github.com/yarnpkg/berry)
## Installation
```
```sh
yarn add clipanion

@@ -16,10 +16,10 @@ ```

- Clipanion supports advanced typing mechanisms
- Clipanion supports nested commands (`yarn workspaces list`)
- Clipanion supports transparent option proxying without `--` (for example `yarn dlx eslint --fix`)
- Clipanion supports all option types you could think of (including negations, batches, ...)
- Clipanion offers a [Typanion](https://github.com/arcanis/typanion) integration for increased validation capabilities
- Clipanion generates an optimized state machine out of your commands
- Clipanion generates good-looking help pages out of the box
- Clipanion offers common optional command entries out-of-the-box (e.g. version command, help command)
- Clipanion supports advanced typing mechanisms
- Clipanion supports nested commands (`yarn workspaces list`)
- Clipanion supports transparent option proxying without `--` (for example `yarn dlx eslint --fix`)
- Clipanion supports all option types you could think of (including negations, batches, ...)
- Clipanion offers a [Typanion](https://github.com/arcanis/typanion) integration for increased validation capabilities
- Clipanion generates an optimized state machine out of your commands
- Clipanion generates good-looking help pages out of the box
- Clipanion offers common optional command entries out-of-the-box (e.g. version command, help command)

@@ -32,2 +32,6 @@ Clipanion is used in [Yarn](https://github.com/yarnpkg/berry) with great success.

## Migration
You can use [`clipanion-v3-codemod`](https://github.com/paul-soporan/clipanion-v3-codemod) to migrate a Clipanion v2 codebase to v3.
## Overview

@@ -34,0 +38,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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