chore(scripts): minor changes to boilerplate in make script

This commit is contained in:
Erica Marigold 2023-09-27 00:25:15 +05:30
parent bc2c63160e
commit fbb44cb4a3
No known key found for this signature in database
GPG key ID: 7843994FD1386E35

View file

@ -9,6 +9,9 @@ local WAX_PREFIX_FORMAT = function(type: "error" | "info", scope: string?)
return stdio.color(if type == "error" then "red" else "green") .. (scope or "[wax]") .. stdio.color("reset") return stdio.color(if type == "error" then "red" else "green") .. (scope or "[wax]") .. stdio.color("reset")
end end
local LARGE_SCALE_FACTOR = 5.5
local REGULAR_SCALE_FACTOR = 4
local BoxifyOutput = function(msg: string) local BoxifyOutput = function(msg: string)
local pad = (" "):rep(#msg / 2) local pad = (" "):rep(#msg / 2)
@ -27,7 +30,7 @@ local BoxifyOutput = function(msg: string)
local processedLines = {} local processedLines = {}
for k, line in lines do for k, line in lines do
local paddedMsg = pad .. line .. (" "):rep((paddingNum * 5.5) - paddingNum - utf8.len(line)) local paddedMsg = pad .. line .. (" "):rep((paddingNum * LARGE_SCALE_FACTOR) - paddingNum - utf8.len(line))
-- This is a hack for outputs made by wax, if the first line contains -- This is a hack for outputs made by wax, if the first line contains
-- "creating directory" -- "creating directory"
@ -38,13 +41,13 @@ local BoxifyOutput = function(msg: string)
table.insert(processedLines, "" .. paddedMsg .. "") table.insert(processedLines, "" .. paddedMsg .. "")
end end
print("" .. (""):rep(paddingNum * 5.5) .. "") print("" .. (""):rep(paddingNum * LARGE_SCALE_FACTOR) .. "")
print(table.concat(processedLines, "\n")) print(table.concat(processedLines, "\n"))
print("" .. (""):rep(paddingNum * 5.5) .. "") print("" .. (""):rep(paddingNum * LARGE_SCALE_FACTOR) .. "")
else else
print("" .. (""):rep(#msg * 4) .. "") print("" .. (""):rep(#msg * REGULAR_SCALE_FACTOR) .. "")
print("" .. pad .. msg .. pad .. " " .. "") print("" .. pad .. msg .. pad .. " " .. "")
print("" .. (""):rep(#msg * 4) .. "") print("" .. (""):rep(#msg * REGULAR_SCALE_FACTOR) .. "")
end end
end end