Skip to content

Commit

Permalink
fix: fix arg[0] path and enable Windows VTE by default
Browse files Browse the repository at this point in the history
  • Loading branch information
cattokomo committed Feb 12, 2024
1 parent d587225 commit caaf304
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions warna.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
---
Expand Down Expand Up @@ -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 <flag>
%s <fmt|text> [<attributes...>]
Expand All @@ -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, " ") })))
Expand Down

0 comments on commit caaf304

Please sign in to comment.