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

cli-engine-command

Package Overview
Dependencies
Maintainers
3
Versions
159
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cli-engine-command - npm Package Compare versions

Comparing version 11.0.5 to 11.0.6

16

lib/command.d.ts

@@ -10,12 +10,11 @@ import { ConfigOptions, IConfig, IPlugin } from 'cli-engine-config';

}
export declare type CommandRunFn = <T extends Command>(this: ICommandClass<T>, config?: ConfigOptions) => Promise<T>;
export declare type CommandMockFn = <T extends Command>(this: ICommandClass<T>, ...argv: string[]) => Promise<IMockReturn<T>>;
export declare type CommandRunFn = <T extends Command>(this: ICommandClass<T>, argv?: string[], config?: ConfigOptions) => Promise<T>;
export declare type CommandMockFn = <T extends Command>(this: ICommandClass<T>, argv?: string[], config?: ConfigOptions) => Promise<IMockReturn<T>>;
export interface ICommandClass<T extends Command> {
mock: CommandMockFn;
run: CommandRunFn;
new ({config}: {
config?: ConfigOptions;
}): T;
new (config: IConfig): T;
}
export declare abstract class Command {
protected config: IConfig;
static topic: string;

@@ -46,3 +45,2 @@ static command: string | undefined;

static buildHelpLine(config: IConfig): [string, string | undefined];
config: IConfig;
http: typeof HTTP;

@@ -64,6 +62,4 @@ flags: {

readonly ctor: typeof Command;
constructor(options?: {
config?: ConfigOptions;
});
init(): Promise<void>;
constructor(config: IConfig);
init(argv: string[]): Promise<void>;
/**

@@ -70,0 +66,0 @@ * actual command run code goes here

@@ -6,7 +6,6 @@ "use strict";

class Command {
constructor(options = {}) {
constructor(config) {
this.config = config;
this.flags = {};
this.args = {};
this.config = deps_1.default.Config.buildConfig(options.config);
this.argv = this.config.argv;
this.http = deps_1.default.HTTP.defaults({

@@ -37,12 +36,12 @@ headers: {

}
async init() {
const { argv, flags, args } = await deps_1.default.CLIFlags.parse({
async init(argv) {
const parse = await deps_1.default.CLIFlags.parse({
argv,
args: this.ctor.args || [],
argv: this.argv.slice(1),
flags: this.ctor.flags || {},
strict: !this.ctor.variableArgs,
});
this.flags = flags;
this.argv = argv;
this.args = args;
this.flags = parse.flags;
this.argv = parse.argv;
this.args = parse.args;
}

@@ -58,4 +57,5 @@ }

*/
Command.mock = async function (...argv) {
const cmd = await this.run({ argv: ['cmd', ...argv] });
Command.mock = async function (argv = [], config = {}) {
deps_1.default.cli.config.mock = true;
const cmd = await this.run(argv, config);
return {

@@ -70,6 +70,6 @@ cmd,

*/
Command.run = async function (config) {
const cmd = new this({ config });
Command.run = async function (argv = [], config = {}) {
const cmd = new this(deps_1.default.Config.buildConfig(config));
try {
await cmd.init();
await cmd.init(argv);
await cmd.run();

@@ -76,0 +76,0 @@ await deps_1.default.cli.done();

{
"name": "cli-engine-command",
"description": "base CLI command for cli-engine",
"version": "11.0.5",
"version": "11.0.6",
"author": "Jeff Dickey @jdxcode",

@@ -17,6 +17,6 @@ "bugs": "https://github.com/heroku/cli-engine-command/issues",

"@types/node": "8.5.2",
"cli-engine-config": "5.0.5",
"cli-engine-config": "5.0.6",
"del-cli": "1.1.0",
"husky": "^0.14.3",
"jest": "^22.0.3",
"jest": "^22.0.4",
"lint-staged": "^6.0.0",

@@ -28,3 +28,3 @@ "nock": "^9.1.5",

"tslint": "^5.8.0",
"tslint-cli-engine": "^1.0.1",
"tslint-cli-engine": "^1.0.3",
"typescript": "2.6.2"

@@ -31,0 +31,0 @@ },

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