From 558273674c6b5803d443616d12a2edcc774ff105 Mon Sep 17 00:00:00 2001 From: Chad Carbert Date: Tue, 23 Jun 2020 12:51:35 -0400 Subject: [PATCH 1/3] Add pretty printable interface to methods on command --- src/command.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/command.ts b/src/command.ts index 7b7721ea..7c5419e4 100644 --- a/src/command.ts +++ b/src/command.ts @@ -8,6 +8,7 @@ import {format, inspect} from 'util' import * as flags from './flags' import {sortBy, uniqBy} from './util' import {getHelpClass} from '@oclif/plugin-help' +import {PrettyPrintableError} from '@oclif/errors/lib/errors/pretty-print' /** * swallows stdout epipe errors @@ -122,11 +123,11 @@ export default abstract class Command { Errors.warn(input) } - error(input: string | Error, options: {code?: string; exit: false}): void + error(input: string | Error, options: {code?: string; exit: false} & PrettyPrintableError): void - error(input: string | Error, options?: {code?: string; exit?: number}): never + error(input: string | Error, options?: {code?: string; exit?: number} & PrettyPrintableError): never - error(input: string | Error, options: {code?: string; exit?: number | false} = {}) { + error(input: string | Error, options: {code?: string; exit?: number | false} & PrettyPrintableError = {}) { return Errors.error(input, options as any) } From 358e6d1a1597116ac0fb884150ff6029535a235d Mon Sep 17 00:00:00 2001 From: Chad Carbert Date: Thu, 25 Jun 2020 11:14:03 -0400 Subject: [PATCH 2/3] Swap PrettyPrintableError to its public export --- package.json | 2 +- src/command.ts | 2 +- yarn.lock | 11 +++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 0855e1c0..c7f33435 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "bugs": "https://github.com/oclif/command/issues", "dependencies": { "@oclif/config": "^1.15.1", - "@oclif/errors": "^1.2.2", + "@oclif/errors": "^1.3.1", "@oclif/parser": "^3.8.3", "@oclif/plugin-help": "^3", "debug": "^4.1.1", diff --git a/src/command.ts b/src/command.ts index 7c5419e4..58a4555b 100644 --- a/src/command.ts +++ b/src/command.ts @@ -8,7 +8,7 @@ import {format, inspect} from 'util' import * as flags from './flags' import {sortBy, uniqBy} from './util' import {getHelpClass} from '@oclif/plugin-help' -import {PrettyPrintableError} from '@oclif/errors/lib/errors/pretty-print' +import {PrettyPrintableError} from '@oclif/errors' /** * swallows stdout epipe errors diff --git a/yarn.lock b/yarn.lock index f52cc58c..faa99569 100644 --- a/yarn.lock +++ b/yarn.lock @@ -73,6 +73,17 @@ strip-ansi "^6.0.0" wrap-ansi "^7.0.0" +"@oclif/errors@^1.3.1": + version "1.3.1" + resolved "https://registry.yarnpkg.com/@oclif/errors/-/errors-1.3.1.tgz#297b783ea1d18e46aa28999c7e1b8b827cd8572a" + integrity sha512-ma9SpBNnAjbJNc8kPl8G8n6oJX0WK0FtosuJ9Y5etHoJrqq/s9GOOIxo47fSXomLT1fmqYX5cW2yeQ2Q39XyAw== + dependencies: + clean-stack "^3.0.0" + fs-extra "^9.0.1" + indent-string "^4.0.0" + strip-ansi "^6.0.0" + wrap-ansi "^7.0.0" + "@oclif/linewrap@^1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@oclif/linewrap/-/linewrap-1.0.0.tgz#aedcb64b479d4db7be24196384897b5000901d91" From 8d61c8c20ccfaf73ed99e1a2940577726282390f Mon Sep 17 00:00:00 2001 From: Chad Carbert Date: Mon, 29 Jun 2020 13:32:03 -0400 Subject: [PATCH 3/3] Use latest @oclif/errors --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index c7f33435..6fedaf21 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "bugs": "https://github.com/oclif/command/issues", "dependencies": { "@oclif/config": "^1.15.1", - "@oclif/errors": "^1.3.1", + "@oclif/errors": "^1.3.3", "@oclif/parser": "^3.8.3", "@oclif/plugin-help": "^3", "debug": "^4.1.1", diff --git a/yarn.lock b/yarn.lock index faa99569..784590e4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -73,10 +73,10 @@ strip-ansi "^6.0.0" wrap-ansi "^7.0.0" -"@oclif/errors@^1.3.1": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@oclif/errors/-/errors-1.3.1.tgz#297b783ea1d18e46aa28999c7e1b8b827cd8572a" - integrity sha512-ma9SpBNnAjbJNc8kPl8G8n6oJX0WK0FtosuJ9Y5etHoJrqq/s9GOOIxo47fSXomLT1fmqYX5cW2yeQ2Q39XyAw== +"@oclif/errors@^1.3.3": + version "1.3.3" + resolved "https://registry.yarnpkg.com/@oclif/errors/-/errors-1.3.3.tgz#fb597dfbc58c6b8609dc0b2fdf91a2d487818a82" + integrity sha512-EJR6AIOEkt/NnARNIVAskPDVtdhtO5TTNXmhDrGqMoWVsr0R6DkkLrMyq95BmHvlVWM1nduoq4fQPuCyuF2jaA== dependencies: clean-stack "^3.0.0" fs-extra "^9.0.1"