From caaf3049c5fc00fc5800142a4ae10317a7e547e0 Mon Sep 17 00:00:00 2001 From: komothecat Date: Mon, 12 Feb 2024 11:23:58 +0000 Subject: [PATCH] fix: fix arg[0] path and enable Windows VTE by default --- warna.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/warna.lua b/warna.lua index 0abd709..3432f2d 100644 --- a/warna.lua +++ b/warna.lua @@ -273,7 +273,7 @@ function warna.format(fmt) return warna.raw_format(fmt) .. "\27[m" end ----@param skip_registry boolean +---@param skip_registry boolean? ---@return boolean ---@return string --- @@ -343,7 +343,7 @@ else local help_flag = isflag and text == "-h" if help_flag or len_arg == 0 then - local prog = arg[0] + local prog = arg[0]:gsub(".-/", "") print(([[ Usage: %s %s [] @@ -360,6 +360,8 @@ Accepts NO_COLOR and FORCE_COLOR to manipulate color support.]]):format(prog, pr os.exit(help_flag and 0 or 1) end + warna.windows_enable_vt() + if not isflag or isflag and text == "-b" then text = isflag and table.remove(arg, 1) or text io.stdout:write(warna.format(warna.apply(text, { table.concat(arg, " ") })))