Describe the enhancement
After color output improvements (link and #583) I think it could be interesting to integrate to this toolkit, as an option disabled by default, color output for the following methods
|
export function debug(message: string): void { |
|
issueCommand('debug', {}, message) |
|
} |
|
|
|
/** |
|
* Adds an error issue |
|
* @param message error issue message. Errors will be converted to string via toString() |
|
*/ |
|
export function error(message: string | Error): void { |
|
issue('error', message instanceof Error ? message.toString() : message) |
|
} |
|
|
|
/** |
|
* Adds an warning issue |
|
* @param message warning issue message. Errors will be converted to string via toString() |
|
*/ |
|
export function warning(message: string | Error): void { |
|
issue('warning', message instanceof Error ? message.toString() : message) |
|
} |
|
|
|
/** |
|
* Writes info to log with console.log. |
|
* @param message info message |
|
*/ |
|
export function info(message: string): void { |
|
process.stdout.write(message + os.EOL) |
|
} |
Code Snippet
Current
|
export function issue(name: string, message: string = ''): void { |
|
issueCommand(name, {}, message) |
|
} |
Change Proposal
import { red, yellow } from 'whatever-lib-to-color-output'
const logColors = {
error: red,
warning: yellow
}
...
function issue(name: string, message: string = '', useColoredMessage: boolean = false): void {
if(!useColoredMessage) issueCommand(name, {}, message)
else {
const paintMessage = logColors[name]
const paintedMessage = paintMessage? paintMessage(message) : message
issueCommand(name, {}, paintMessage(paintedMessage))
}
}
Additional information
Here are some comparisons for some packages for coloring the output:
In case this feature has sense, I guess it will need to be discussed how and which external package or internal utility to use.
Describe the enhancement
After color output improvements (link and #583) I think it could be interesting to integrate to this toolkit, as an option disabled by default, color output for the following methods
toolkit/packages/core/src/core.ts
Lines 144 to 170 in 85f6235
Code Snippet
Current
toolkit/packages/core/src/command.ts
Lines 32 to 34 in 85f6235
Change Proposal
Additional information
Here are some comparisons for some packages for coloring the output:
In case this feature has sense, I guess it will need to be discussed how and which external package or internal utility to use.