fix: correct no files check to compensate for pipes

pull/240/head
sammyette 2023-10-24 23:59:53 -04:00
parent 003100d3c4
commit 8fabdf4502
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
1 changed files with 12 additions and 12 deletions

View File

@ -102,23 +102,23 @@ commander.register('greenhouse', function(args, sinks)
gh:addPage(page)
end
if #args ~= 0 then
for _, name in ipairs(args) do
local f <close> = io.open(name, 'r')
if not f then
sinks.err:writeln(string.format('could not open file %s', name))
end
local page = Page(name, f:read '*a')
gh:addPage(page)
end
ansikit.hideCursor()
gh:initUi()
else
if #gh.pages == 0 then
sinks.out:writeln [[greenhouse is the Hilbish pager library and command!
usage: greenhouse <file>...
example: greenhouse hello.md]]
return 1
end
ansikit.hideCursor()
gh:initUi()
end)