Skip to content

Commit

Permalink
NO_COLOR
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl committed Jan 19, 2023
1 parent 5c7f36b commit 4371766
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/app.help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ export default async function help() {
environment variables:
TEA_PREFIX stow packages here
TEA_MAGIC [0,1] if shell magic is active, \`TEA_MAGIC=0\` disables it
TEA_MAGIC if shell magic is active, \`TEA_MAGIC=0\` disables it
NO_COLOR suppresses outputting color codes
VERBOSE {-1: silent, 0: default, 1: verbose, 2: debug}
DEBUG [0,1]: alias for \`VERBOSE=2\`
DEBUG alias for \`VERBOSE=2\`
• explicit flags override any environment variables
Expand Down
4 changes: 3 additions & 1 deletion src/hooks/useLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ export default function useLogger(prefix?: string) {
}

function colorIfTTY(x: string, colorMethod: (x: string)=>string) {
if (Deno.env.get("CI")) {
if (Deno.env.get("NO_COLOR")) {
return x
} else if (Deno.env.get("CI")) {
// this is what charm’s lipgloss does, we copy their lead
return colorMethod(x)
} else if (Deno.isatty(Deno.stdout.rid) && Deno.isatty(Deno.stderr.rid)) {
Expand Down

0 comments on commit 4371766

Please sign in to comment.