Socket
Socket
Sign inDemoInstall

@oclif/core

Package Overview
Dependencies
Maintainers
5
Versions
396
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.8 to 0.5.9

2

CHANGELOG.md

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

### [0.5.9](https://github.com/oclif/core/compare/v0.5.8...v0.5.9) (2021-05-27)
### [0.5.8](https://github.com/oclif/core/compare/v0.5.7...v0.5.8) (2021-05-26)

@@ -7,0 +9,0 @@

4

lib/help/_test-help-class.d.ts
import { HelpBase } from '.';
export default class extends HelpBase {
showHelp(): void;
showCommandHelp(): void;
showHelp(): Promise<void>;
showCommandHelp(): Promise<void>;
getCommandHelpForReadme(): string;
}
"use strict";
// `getHelpClass` tests require an oclif project for testing so
// `loadHelpClass` tests require an oclif project for testing so
// it is re-using the setup here to be able to do a lookup for

@@ -9,6 +9,6 @@ // this sample help class file in tests, although it is not needed

class default_1 extends _1.HelpBase {
showHelp() {
async showHelp() {
console.log('help');
}
showCommandHelp() {
async showCommandHelp() {
console.log('command help');

@@ -15,0 +15,0 @@ }

import * as Interfaces from '../interfaces';
export { standardizeIDFromArgv, getHelpClass } from './util';
export { standardizeIDFromArgv, loadHelpClass } from './util';
export declare abstract class HelpBase {

@@ -11,3 +11,3 @@ constructor(config: Interfaces.Config, opts?: Partial<Interfaces.HelpOptions>);

*/
abstract showHelp(argv: string[]): void;
abstract showHelp(argv: string[]): Promise<void>;
/**

@@ -18,3 +18,3 @@ * Show help for an individual command

*/
abstract showCommandHelp(command: Interfaces.Command, topics: Interfaces.Topic[]): void;
abstract showCommandHelp(command: Interfaces.Command, topics: Interfaces.Topic[]): Promise<void>;
}

@@ -27,6 +27,6 @@ export declare class Help extends HelpBase {

constructor(config: Interfaces.Config, opts?: Partial<Interfaces.HelpOptions>);
showHelp(argv: string[]): void;
showCommandHelp(command: Interfaces.Command): void;
protected showRootHelp(): void;
protected showTopicHelp(topic: Interfaces.Topic): void;
showHelp(argv: string[]): Promise<void>;
showCommandHelp(command: Interfaces.Command): Promise<void>;
protected showRootHelp(): Promise<void>;
protected showTopicHelp(topic: Interfaces.Topic): Promise<void>;
protected formatRoot(): string;

@@ -33,0 +33,0 @@ protected formatCommand(command: Interfaces.Command): string;

@@ -15,3 +15,3 @@ "use strict";

exports.standardizeIDFromArgv = util_3.standardizeIDFromArgv;
exports.getHelpClass = util_3.getHelpClass;
exports.loadHelpClass = util_3.loadHelpClass;
const wrap = require('wrap-ansi');

@@ -71,3 +71,3 @@ const { bold, } = Chalk;

}
showHelp(argv) {
async showHelp(argv) {
if (this.config.topicSeparator !== ':')

@@ -80,5 +80,5 @@ argv = util_2.standardizeIDFromArgv(argv, this.config);

if (rootCmd)
this.showCommandHelp(rootCmd);
await this.showCommandHelp(rootCmd);
}
this.showRootHelp();
await this.showRootHelp();
return;

@@ -88,3 +88,3 @@ }

if (command) {
this.showCommandHelp(command);
await this.showCommandHelp(command);
return;

@@ -94,3 +94,3 @@ }

if (topic) {
this.showTopicHelp(topic);
await this.showTopicHelp(topic);
return;

@@ -100,3 +100,3 @@ }

}
showCommandHelp(command) {
async showCommandHelp(command) {
const name = command.id;

@@ -120,3 +120,3 @@ const depth = name.split(':').length;

}
showRootHelp() {
async showRootHelp() {
let rootTopics = this.sortedTopics;

@@ -140,3 +140,3 @@ let rootCommands = this.sortedCommands;

}
showTopicHelp(topic) {
async showTopicHelp(topic) {
const name = topic.name;

@@ -143,0 +143,0 @@ const depth = name.split(':').length;

@@ -6,3 +6,3 @@ import { Config as IConfig, HelpOptions } from '../interfaces';

}
export declare function getHelpClass(config: IConfig): HelpBaseDerived;
export declare function loadHelpClass(config: IConfig): Promise<HelpBaseDerived>;
export declare function template(context: any): (t: string) => string;

@@ -9,0 +9,0 @@ export declare function toStandardizedId(commandID: string, config: IConfig): string;

@@ -5,11 +5,7 @@ "use strict";

const _1 = require(".");
const Config = require("../config");
function extractExport(config, classPath) {
const helpClassPath = Config.tsPath(config.root, classPath);
return require(helpClassPath);
}
const module_loader_1 = require("../module-loader");
function extractClass(exported) {
return exported && exported.default ? exported.default : exported;
}
function getHelpClass(config) {
async function loadHelpClass(config) {
const pjson = config.pjson;

@@ -19,3 +15,3 @@ const configuredClass = pjson && pjson.oclif && pjson.oclif.helpClass;

try {
const exported = extractExport(config, configuredClass);
const exported = await module_loader_1.default.load(config, configuredClass);
return extractClass(exported);

@@ -29,3 +25,3 @@ }

}
exports.getHelpClass = getHelpClass;
exports.loadHelpClass = loadHelpClass;
function template(context) {

@@ -32,0 +28,0 @@ function render(t) {

@@ -7,3 +7,3 @@ import Command from './command';

import * as Flags from './flags';
import { HelpBase, Help, getHelpClass } from './help';
import { HelpBase, Help, loadHelpClass } from './help';
import { toStandardizedId, toConfiguredId } from './help/util';

@@ -13,2 +13,2 @@ import * as Parser from './parser';

import { settings, Settings } from './settings';
export { Command, Config, Errors, Flags, getHelpClass, Help, HelpBase, Hook, Interfaces, Parser, Plugin, run, toCached, tsPath, toStandardizedId, toConfiguredId, settings, Settings, };
export { Command, Config, Errors, Flags, loadHelpClass, Help, HelpBase, Hook, Interfaces, Parser, Plugin, run, toCached, tsPath, toStandardizedId, toConfiguredId, settings, Settings, };

@@ -23,3 +23,3 @@ "use strict";

exports.Help = help_1.Help;
exports.getHelpClass = help_1.getHelpClass;
exports.loadHelpClass = help_1.loadHelpClass;
const util_1 = require("./help/util");

@@ -26,0 +26,0 @@ exports.toStandardizedId = util_1.toStandardizedId;

@@ -47,5 +47,5 @@ "use strict";

});
const Help = help_1.getHelpClass(config);
const Help = await help_1.loadHelpClass(config);
const help = new Help(config);
help.showHelp(argv);
await help.showHelp(argv);
return;

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

{
"name": "@oclif/core",
"description": "base library for oclif CLIs",
"version": "0.5.8",
"version": "0.5.9",
"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