Skip to content

Commit

Permalink
feat: Support NO_COLOR environment variable (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
ligurio authored Oct 24, 2023
1 parent 494c8a9 commit 031db72
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/luacheck/format.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ local utils = require "luacheck.utils"
local format = {}

local color_support = not utils.is_windows or os.getenv("ANSICON")
-- Disable colors when NO_COLOR is set, see https://no-color.org/.
color_support = color_support and not os.getenv("NO_COLOR")

local function get_message_format(warning)
local message_format = assert(stages.warnings[warning.code], "Unknown warning code " .. warning.code).message_format
Expand Down

0 comments on commit 031db72

Please sign in to comment.