Compare commits

..

No commits in common. "554fb009f8c4b403c86aa4c9b9e07a02650f9a01" and "19bb05f001b3315d6c15311b9a8a04e42036f615" have entirely different histories.

3 changed files with 15 additions and 24 deletions

View File

@ -103,7 +103,7 @@ Available sections: ]] .. table.concat(modules, ', ')
if not self.isSpecial then if not self.isSpecial then
if args[1] == 'api' then if args[1] == 'api' then
self.sink:writeln(lunacolors.reset(string.format('%s', vals.title))) self.sink:writeln(lunacolors.reset(string.format('%s', vals.title)))
self.sink:write(lunacolors.format(string.format('{grayBg} ↳ {white}{italic}%s {reset}', vals.description or 'No description.'))) self.sink:write(lunacolors.format(string.format('{grayBg} ↳ {white}{italic}%s {reset}', vals.description)))
else else
self.sink:write(lunacolors.reset(string.format('Viewing doc page %s', moddocPath))) self.sink:write(lunacolors.reset(string.format('Viewing doc page %s', moddocPath)))
end end

View File

@ -2,7 +2,6 @@ local ansikit = require 'ansikit'
local bait = require 'bait' local bait = require 'bait'
local commander = require 'commander' local commander = require 'commander'
local hilbish = require 'hilbish' local hilbish = require 'hilbish'
local lunacolors = require 'lunacolors'
local terminal = require 'terminal' local terminal = require 'terminal'
local Greenhouse = require 'nature.greenhouse' local Greenhouse = require 'nature.greenhouse'
local Page = require 'nature.greenhouse.page' local Page = require 'nature.greenhouse.page'
@ -43,7 +42,12 @@ commander.register('greenhouse', function(args, sinks)
self.sink:write(ansikit.getCSI(self.region.height + 1 .. ';1', 'H')) self.sink:write(ansikit.getCSI(self.region.height + 1 .. ';1', 'H'))
if not self.isSpecial then if not self.isSpecial then
self.sink:writeln(lunacolors.format(string.format('{grayBg} ↳ Page %d %s{reset}', self.curPage, workingPage.title and '' .. workingPage.title .. ' ' or ''))) self.sink:write(string.format('\27[0mPage %d', self.curPage))
if workingPage.title ~= '' then
self.sink:writeln('' .. workingPage.title)
else
self.sink:writeln('')
end
end end
self.sink:write(buffer == '' and display or buffer) self.sink:write(buffer == '' and display or buffer)
end end
@ -102,7 +106,6 @@ commander.register('greenhouse', function(args, sinks)
gh:addPage(page) gh:addPage(page)
end end
if #args ~= 0 then
for _, name in ipairs(args) do for _, name in ipairs(args) do
local f <close> = io.open(name, 'r') local f <close> = io.open(name, 'r')
if not f then if not f then
@ -112,13 +115,7 @@ commander.register('greenhouse', function(args, sinks)
local page = Page(name, f:read '*a') local page = Page(name, f:read '*a')
gh:addPage(page) gh:addPage(page)
end end
ansikit.hideCursor() ansikit.hideCursor()
gh:initUi() gh:initUi()
else
sinks.out:writeln [[greenhouse is the Hilbish pager library and command!
usage: greenhouse <file>...
example: greenhouse hello.md]]
end
end) end)

View File

@ -27,12 +27,6 @@ function Greenhouse:new(sink)
['Ctrl-Left'] = self.previous, ['Ctrl-Left'] = self.previous,
['Ctrl-Right'] = self.next, ['Ctrl-Right'] = self.next,
['Ctrl-N'] = function(self) self:toc(true) end, ['Ctrl-N'] = function(self) self:toc(true) end,
['Enter'] = function(self)
if self.isSpecial then
self:jump(self.specialPageIdx)
self:special(false)
end
end
} }
self.isSpecial = false self.isSpecial = false
self.specialPage = nil self.specialPage = nil