Skip to content

Commit

Permalink
fix: correct no files check to compensate for pipes
Browse files Browse the repository at this point in the history
  • Loading branch information
TorchedSammy committed Oct 25, 2023
1 parent 003100d commit 8fabdf4
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions nature/commands/greenhouse.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
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
ansikit.hideCursor()
gh:initUi()
else
local page = Page(name, f:read '*a')
gh:addPage(page)
end

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)

0 comments on commit 8fabdf4

Please sign in to comment.