feat: support YAZI_FILE_ONE environment variable for file(1) path (#752)

This commit is contained in:
Nguyễn Đức Toàn 2024-03-01 10:21:44 +07:00 committed by GitHub
parent 7f062359e8
commit 8508a5f577
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -15,9 +15,10 @@ function M:preload()
urls[#urls + 1] = tostring(file.url)
end
local child, code = Command("file"):args({ "-bL", "--mime-type" }):args(urls):stdout(Command.PIPED):spawn()
local cmd = os.getenv("YAZI_FILE_ONE") or "file"
local child, code = Command(cmd):args({ "-bL", "--mime-type" }):args(urls):stdout(Command.PIPED):spawn()
if not child then
ya.err("spawn `file` command returns " .. tostring(code))
ya.err(string.format("spawn `%s` command returns %s", cmd, code))
return 0
end