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

@oclif/core

Package Overview
Dependencies
Maintainers
5
Versions
405
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@oclif/core - npm Package Compare versions

Comparing version 0.5.26 to 0.5.27

7

CHANGELOG.md

@@ -5,2 +5,9 @@ # Changelog

### [0.5.27](https://github.com/oclif/core/compare/v0.5.26...v0.5.27) (2021-07-29)
### Bug Fixes
* restore short flags for --help and --version ([#205](https://github.com/oclif/core/issues/205)) ([67dadd4](https://github.com/oclif/core/commit/67dadd413dfbdd7742a3cd91e7ce1d5dfc7421da))
### [0.5.26](https://github.com/oclif/core/compare/v0.5.25...v0.5.26) (2021-07-22)

@@ -7,0 +14,0 @@

8

lib/flags.js

@@ -27,5 +27,3 @@ "use strict";

exports.version = (opts = {}) => {
return Parser.flags.boolean(Object.assign(Object.assign({
// char: 'v',
description: 'show CLI version' }, opts), { parse: async (_, cmd) => {
return Parser.flags.boolean(Object.assign(Object.assign({ description: 'show CLI version' }, opts), { parse: async (_, cmd) => {
cmd.log(cmd.config.userAgent);

@@ -36,7 +34,5 @@ cmd.exit(0);

exports.help = (opts = {}) => {
return Parser.flags.boolean(Object.assign(Object.assign({
// char: 'h',
description: 'show CLI help' }, opts), { parse: async (_, cmd) => {
return Parser.flags.boolean(Object.assign(Object.assign({ description: 'show CLI help' }, opts), { parse: async (_, cmd) => {
cmd._help();
} }));
};

@@ -6,2 +6,3 @@ import * as Interfaces from '../interfaces';

export { standardizeIDFromArgv, loadHelpClass } from './util';
export declare function getHelpFlagAdditions(config: Interfaces.Config): string[];
export declare abstract class HelpBase extends HelpFormatter {

@@ -8,0 +9,0 @@ constructor(config: Interfaces.Config, opts?: Partial<Interfaces.HelpOptions>);

@@ -15,7 +15,16 @@ "use strict";

exports.loadHelpClass = util_3.loadHelpClass;
function getHelpSubject(args) {
const helpFlags = ['--help'];
function getHelpFlagAdditions(config) {
var _a;
const additionalHelpFlags = (_a = config.pjson.oclif.additionalHelpFlags) !== null && _a !== void 0 ? _a : [];
return [...new Set([...helpFlags, ...additionalHelpFlags]).values()];
}
exports.getHelpFlagAdditions = getHelpFlagAdditions;
function getHelpSubject(args, config) {
// for each help flag that starts with '--' create a new flag with same name sans '--'
const mergedHelpFlags = getHelpFlagAdditions(config);
for (const arg of args) {
if (arg === '--')
return;
if (arg === 'help' || arg === '--help')
if (mergedHelpFlags.includes(arg) || arg === 'help')
continue;

@@ -70,3 +79,3 @@ if (arg.startsWith('-'))

argv = util_2.standardizeIDFromArgv(argv, this.config);
const subject = getHelpSubject(argv);
const subject = getHelpSubject(argv, this.config);
if (!subject) {

@@ -73,0 +82,0 @@ if (this.config.pjson.oclif.default) {

@@ -50,2 +50,4 @@ import { HelpOptions } from './help';

};
additionalHelpFlags?: string[];
additionalVersionFlags?: string[];
};

@@ -52,0 +54,0 @@ }

import * as Interfaces from './interfaces';
export declare const helpAddition: (argv: string[], config: Interfaces.Config) => boolean;
export declare const versionAddition: (argv: string[], config?: Interfaces.Config | undefined) => boolean;
export declare function run(argv?: string[], options?: Interfaces.LoadOptions): Promise<unknown>;

@@ -12,7 +12,8 @@ "use strict";

};
const helpOverride = (argv, config) => {
exports.helpAddition = (argv, config) => {
if (argv.length === 0 && !config.pjson.oclif.default)
return true;
const mergedHelpFlags = help_1.getHelpFlagAdditions(config);
for (const arg of argv) {
if (arg === '--help')
if (mergedHelpFlags.includes(arg))
return true;

@@ -24,4 +25,7 @@ if (arg === '--')

};
const versionOverride = (argv) => {
if (['--version'].includes(argv[0]))
exports.versionAddition = (argv, config) => {
var _a;
const additionalVersionFlags = (_a = config === null || config === void 0 ? void 0 : config.pjson.oclif.additionalVersionFlags) !== null && _a !== void 0 ? _a : [];
const mergedVersionFlags = [...new Set([...['--version'], ...additionalVersionFlags]).values()];
if (mergedVersionFlags.includes(argv[0]))
return true;

@@ -44,3 +48,3 @@ return false;

// display version if applicable
if (versionOverride(argv)) {
if (exports.versionAddition(argv, config)) {
log(config.userAgent);

@@ -50,8 +54,4 @@ return;

// display help version if applicable
if (helpOverride(argv, config)) {
argv = argv.filter(arg => {
if (arg === '--help')
return false;
return true;
});
if (exports.helpAddition(argv, config)) {
argv = argv.filter(arg => !help_1.getHelpFlagAdditions(config).includes(arg));
const Help = await help_1.loadHelpClass(config);

@@ -58,0 +58,0 @@ const help = new Help(config, config.pjson.helpOptions);

{
"name": "@oclif/core",
"description": "base library for oclif CLIs",
"version": "0.5.26",
"version": "0.5.27",
"author": "Jeff Dickey @jdxcode",

@@ -6,0 +6,0 @@ "bugs": "https://github.com/oclif/core/issues",

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