Output
Class Output
Hierarchy
Output
Index
Properties
Methods
- addCrossTable
- addData
- addHorizontalTable
- addVerticalTable
- error
- flush
- resetData
- send
- setExitCode
- create
- errorOutput
Properties
Private data
data: any[] = []
Defined in Library/Output/Output.ts:8
Private exitCode
exitCode: number = 0
Defined in Library/Output/Output.ts:6
Private prettyError
prettyError: PrettyError = new PrettyError()
Defined in Library/Output/Output.ts:10
Methods
addCrossTable
addCrossTable(head: string[], data: object[], options?: any): this
Defined in Library/Output/Output.ts:88
Parameters:
| Name | Type | Default value |
|---|---|---|
| head | string[] | - |
| data | object[] | - |
Default value options | any | {} |
Returns: this
addData
addData(data: any): this
Defined in Library/Output/Output.ts:52
Parameters:
| Name | Type |
|---|---|
| data | any |
Returns: this
addHorizontalTable
addHorizontalTable(head: string[], data: Array<string>[], options?: any): this
Defined in Library/Output/Output.ts:68
Parameters:
| Name | Type | Default value |
|---|---|---|
| head | string[] | - |
| data | Array<string>[] | - |
Default value options | any | {} |
Returns: this
addVerticalTable
addVerticalTable(data: object[], options?: any): this
Defined in Library/Output/Output.ts:78
Parameters:
| Name | Type |
|---|---|
| data | object[] |
Optional options | any |
Returns: this
error
error(error?: * Error | string*, exitCode?: number, clear?: boolean): this
Defined in Library/Output/Output.ts:107
Add/set an error to output.
Parameters:
| Name | Type | Default value |
|---|---|---|
Default value error | Error | string | "Unknown error" |
Default value exitCode | number | 1 |
Default value clear | boolean | false |
Returns: this
flush
flush(): void
Defined in Library/Output/Output.ts:128
Write the output to the console.
Returns: void
resetData
resetData(): this
Defined in Library/Output/Output.ts:62
Returns: this
send
send(): void
Defined in Library/Output/Output.ts:132
Returns: void
setExitCode
setExitCode(exitCode: number): this
Defined in Library/Output/Output.ts:46
Exit code to use upon send.
NOTE: Exit codes 1 - 2, 126 - 165, and 255 have special meanings and should therefore be avoided for user-specified exit parameters. Try restricting user-defined exit codes to the range 64 - 113 (in addition to 0, for success).
1 - Catchall for general errors 2 - Misuse of shell builtins (according to Bash documentation) 126 - Command invoked cannot execute 127 - “command not found” 128 - Invalid argument to exit 128+n - Fatal error signal “n” 130 - Script terminated by Control-C 255* - Exit status out of range see: http://tldp.org/LDP/abs/html/exitcodes.html
Parameters:
| Name | Type | Description |
|---|---|---|
| exitCode | number |
Returns: this
Static create
create(): Output
Defined in Library/Output/Output.ts:12
Returns: Output
Static errorOutput
errorOutput(error?: * string | Error*, exitCode?: number): Output
Defined in Library/Output/Output.ts:16
Parameters:
| Name | Type |
|---|---|
Optional error | string | Error |
Optional exitCode | number |
Returns: Output