Skip to content
This repository was archived by the owner on Aug 22, 2023. It is now read-only.

Commit 2db646d

Browse files
authored
feat: add pretty printable interface to methods on command (#96)
1 parent a95a224 commit 2db646d

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"bugs": "https://github.com/oclif/command/issues",
77
"dependencies": {
88
"@oclif/config": "^1.15.1",
9-
"@oclif/errors": "^1.2.2",
9+
"@oclif/errors": "^1.3.3",
1010
"@oclif/parser": "^3.8.3",
1111
"@oclif/plugin-help": "^3",
1212
"debug": "^4.1.1",

src/command.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {format, inspect} from 'util'
88
import * as flags from './flags'
99
import {sortBy, uniqBy} from './util'
1010
import {getHelpClass} from '@oclif/plugin-help'
11+
import {PrettyPrintableError} from '@oclif/errors'
1112

1213
/**
1314
* swallows stdout epipe errors
@@ -122,11 +123,11 @@ export default abstract class Command {
122123
Errors.warn(input)
123124
}
124125

125-
error(input: string | Error, options: {code?: string; exit: false}): void
126+
error(input: string | Error, options: {code?: string; exit: false} & PrettyPrintableError): void
126127

127-
error(input: string | Error, options?: {code?: string; exit?: number}): never
128+
error(input: string | Error, options?: {code?: string; exit?: number} & PrettyPrintableError): never
128129

129-
error(input: string | Error, options: {code?: string; exit?: number | false} = {}) {
130+
error(input: string | Error, options: {code?: string; exit?: number | false} & PrettyPrintableError = {}) {
130131
return Errors.error(input, options as any)
131132
}
132133

yarn.lock

+11
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,17 @@
7373
strip-ansi "^6.0.0"
7474
wrap-ansi "^7.0.0"
7575

76+
"@oclif/errors@^1.3.3":
77+
version "1.3.3"
78+
resolved "https://registry.yarnpkg.com/@oclif/errors/-/errors-1.3.3.tgz#fb597dfbc58c6b8609dc0b2fdf91a2d487818a82"
79+
integrity sha512-EJR6AIOEkt/NnARNIVAskPDVtdhtO5TTNXmhDrGqMoWVsr0R6DkkLrMyq95BmHvlVWM1nduoq4fQPuCyuF2jaA==
80+
dependencies:
81+
clean-stack "^3.0.0"
82+
fs-extra "^9.0.1"
83+
indent-string "^4.0.0"
84+
strip-ansi "^6.0.0"
85+
wrap-ansi "^7.0.0"
86+
7687
"@oclif/linewrap@^1.0.0":
7788
version "1.0.0"
7889
resolved "https://registry.yarnpkg.com/@oclif/linewrap/-/linewrap-1.0.0.tgz#aedcb64b479d4db7be24196384897b5000901d91"

0 commit comments

Comments
 (0)