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

feat: add pretty printable interface to methods on command #96

Merged
merged 3 commits into from
Jun 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.3",
"@oclif/parser": "^3.8.3",
"@oclif/plugin-help": "^3",
"debug": "^4.1.1",
Expand Down
7 changes: 4 additions & 3 deletions src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

/**
* swallows stdout epipe errors
Expand Down Expand Up @@ -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)
}

Expand Down
11 changes: 11 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@
strip-ansi "^6.0.0"
wrap-ansi "^7.0.0"

"@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"
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"
Expand Down