Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

command-line-interface

Package Overview
Dependencies
Maintainers
4
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

command-line-interface - npm Package Compare versions

Comparing version 3.2.0 to 3.2.1

3

build/lib/convertOptionDefinition.js

@@ -6,2 +6,5 @@ "use strict";

let type;
if (optionDefinition.type === 'boolean' && optionDefinition.defaultOption) {
throw new errors_1.errors.OptionInvalid(`Option '${optionDefinition.name}' must not be a default option, because it is boolean.`);
}
switch (optionDefinition.type) {

@@ -8,0 +11,0 @@ case 'boolean':

@@ -24,3 +24,8 @@ "use strict";

if (defaultOption) {
synopsis += ` ${optionToString_1.optionToString({ option: defaultOption })}`;
if (defaultOption.isRequired) {
synopsis += ` ${optionToString_1.optionToString({ option: defaultOption })}`;
}
else {
synopsis += ` [${optionToString_1.optionToString({ option: defaultOption })}]`;
}
}

@@ -27,0 +32,0 @@ return synopsis;

8

build/lib/usage/optionToString.js

@@ -5,8 +5,10 @@ "use strict";

var _a;
const prefix = option.defaultOption ? '' : '--';
const parameterName = (_a = option.parameterName, (_a !== null && _a !== void 0 ? _a : option.type));
const multiplier = option.multiple === undefined || option.multiple === 'off' ? '' : '[]';
const parameterDescription = option.type === 'boolean' ? '' : ` {underline ${parameterName}${multiplier}}`;
return `${prefix}${option.name}${parameterDescription}`;
const parameterDescription = option.type === 'boolean' ? '' : `{underline ${parameterName}${multiplier}}`;
if (option.defaultOption) {
return parameterDescription;
}
return `--${option.name}${parameterDescription ? ' ' : ''}${parameterDescription}`;
};
exports.optionToString = optionToString;

@@ -0,1 +1,8 @@

## [3.2.1](https://github.com/thenativeweb/command-line-interface/compare/3.2.0...3.2.1) (2020-02-07)
### Bug Fixes
* Fix display of default option name. ([#28](https://github.com/thenativeweb/command-line-interface/issues/28)) ([7e2605e](https://github.com/thenativeweb/command-line-interface/commit/7e2605e8552d6d63dbabec8f0feec875235e616c))
# [3.2.0](https://github.com/thenativeweb/command-line-interface/compare/3.1.3...3.2.0) (2020-02-07)

@@ -2,0 +9,0 @@

@@ -10,2 +10,6 @@ import { OptionDefinition as CLAOptionDefinition } from 'command-line-args';

if (optionDefinition.type === 'boolean' && optionDefinition.defaultOption) {
throw new errors.OptionInvalid(`Option '${optionDefinition.name}' must not be a default option, because it is boolean.`);
}
switch (optionDefinition.type) {

@@ -12,0 +16,0 @@ case 'boolean':

@@ -37,3 +37,7 @@ import { Command } from '../elements/Command';

if (defaultOption) {
synopsis += ` ${optionToString({ option: defaultOption })}`;
if (defaultOption.isRequired) {
synopsis += ` ${optionToString({ option: defaultOption })}`;
} else {
synopsis += ` [${optionToString({ option: defaultOption })}]`;
}
}

@@ -40,0 +44,0 @@

@@ -6,11 +6,13 @@ import { OptionDefinition } from '../elements/OptionDefinition';

}): string => {
const prefix = option.defaultOption ? '' : '--';
const parameterName = option.parameterName ?? option.type;
const multiplier = option.multiple === undefined || option.multiple === 'off' ? '' : '[]';
const parameterDescription = option.type === 'boolean' ? '' : ` {underline ${parameterName}${multiplier}}`;
const parameterDescription = option.type === 'boolean' ? '' : `{underline ${parameterName}${multiplier}}`;
return `${prefix}${option.name}${parameterDescription}`;
if (option.defaultOption) {
return parameterDescription;
}
return `--${option.name}${parameterDescription ? ' ' : ''}${parameterDescription}`;
};
export { optionToString };
{
"name": "command-line-interface",
"version": "3.2.0",
"version": "3.2.1",
"description": "command-line-interface is a foundation for CLI applications.",

@@ -5,0 +5,0 @@ "contributors": [

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