fix: add colors to cli

This commit is contained in:
Amin Yahyaabadi 2021-09-17 15:00:26 -05:00
parent d82045ec40
commit 1a1befa1c9
3 changed files with 10 additions and 7 deletions

3
dist/setup_cpp.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -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