mirror of https://github.com/aminya/setup-cpp
fix: add colors to cli
This commit is contained in:
parent
d82045ec40
commit
1a1befa1c9
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -67,6 +67,8 @@ const inputs: Array<Inputs> = ["compiler", "architecture", ...tools]
|
|||
|
||||
/** The main entry function */
|
||||
export async function main(args: string[]): Promise<number> {
|
||||
const isCI = Boolean(process.env.CI)
|
||||
|
||||
// parse options using mri or github actions
|
||||
const opts = mri<Record<Inputs, string | undefined> & { help: boolean }>(args, {
|
||||
string: inputs,
|
||||
|
@ -172,8 +174,8 @@ export async function main(args: string[]): Promise<number> {
|
|||
}
|
||||
|
||||
// report the messages in the end
|
||||
successMessages.forEach((tool) => core.info(tool))
|
||||
errorMessages.forEach((tool) => core.error(tool))
|
||||
successMessages.forEach((tool) => (isCI ? core.info(tool) : console.log(`\x1b[32m${tool}\x1b[0m`)))
|
||||
errorMessages.forEach((tool) => (isCI ? core.error(tool) : console.log(`\x1b[31m${tool}\x1b[0m`)))
|
||||
|
||||
core.info("setup_cpp finished")
|
||||
return errorMessages.length === 0 ? 0 : 1 // exit with non-zero if any error message
|
||||
|
|
Loading…
Reference in New Issue