Skip to content

Commit

Permalink
feat: add default exit code
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Dec 4, 2023
1 parent 6f15fdd commit 3606de9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/errors/errors/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import cs from 'clean-stack'
import indent from 'indent-string'
import wrap from 'wrap-ansi'

import Cache from '../../cache'
import {OclifError, PrettyPrintableError} from '../../interfaces/errors'
import {errtermwidth} from '../../screen'
import {config} from '../config'
Expand All @@ -16,7 +17,7 @@ export function addOclifExitCode(error: Record<string, any>, options?: {exit?: f
;(error as unknown as OclifError).oclif = {}
}

error.oclif.exit = options?.exit === undefined ? 2 : options.exit
error.oclif.exit = options?.exit === undefined ? Cache.getInstance().get('exitCodes')?.default ?? 2 : options.exit
return error as OclifError
}

Expand Down
1 change: 1 addition & 0 deletions src/interfaces/pjson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export namespace PJSON {
description?: string
devPlugins?: string[]
exitCodes?: {
default?: number
failedFlagParsing?: number
failedFlagValidation?: number
invalidArgsSpec?: number
Expand Down

0 comments on commit 3606de9

Please sign in to comment.