fix: reduce function list to match in go generated docs

document-lua
sammyette 2024-12-24 18:59:32 -04:00
parent 5545002d92
commit b7af6177ba
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
2 changed files with 19 additions and 10 deletions

View File

@ -125,16 +125,21 @@ for iface, dps in pairs(pieces) do
for func, docs in pairs(dps) do for func, docs in pairs(dps) do
local sig = string.format('%s.%s(', iface, func) local sig = string.format('%s.%s(', iface, func)
local params = ''
for idx, param in ipairs(docs.params) do for idx, param in ipairs(docs.params) do
sig = sig .. ((param.name:gsub('%?$', ''))) sig = sig .. param.name:gsub('%?$', '')
if idx ~= #docs.params then sig = sig .. ', ' end params = params .. param.name:gsub('%?$', '')
if idx ~= #docs.params then
sig = sig .. ', '
params = params .. ', '
end
end end
sig = sig .. ')' sig = sig .. ')'
if tocPos then if tocPos then
local pos = f:seek() local pos = f:seek()
f:seek('set', tocPos) f:seek('set', tocPos)
f:write(string.format('|<a href="#%s">%s</a>|%s|\n', func, sig, docs.description[1])) f:write(string.format('|<a href="#%s">%s</a>|%s|\n', func, string.format('%s(%s)', func, params), docs.description[1]))
tocPos = f:seek() tocPos = f:seek()
f:seek('set', pos) f:seek('set', pos)
end end

View File

@ -57,13 +57,17 @@ end)
|<a href="#runner.setMode">setMode(cb)</a>|This is the same as the `hilbish.runnerMode` function.| |<a href="#runner.setMode">setMode(cb)</a>|This is the same as the `hilbish.runnerMode` function.|
|<a href="#runner.lua">lua(cmd)</a>|Evaluates `cmd` as Lua input. This is the same as using `dofile`| |<a href="#runner.lua">lua(cmd)</a>|Evaluates `cmd` as Lua input. This is the same as using `dofile`|
|<a href="#runner.sh">sh(cmd)</a>|Runs a command in Hilbish's shell script interpreter.| |<a href="#runner.sh">sh(cmd)</a>|Runs a command in Hilbish's shell script interpreter.|
|<a href="#getCurrent">hilbish.runner.getCurrent()</a>|Returns the current runner by name.| |<a href="#getCurrent">getCurrent()</a>|Returns the current runner by name.|
|<a href="#setCurrent">hilbish.runner.setCurrent(name)</a>|Sets the current interactive/command line runner mode.| |<a href="#setCurrent">setCurrent(name)</a>|Sets the current interactive/command line runner mode.|
|<a href="#add">hilbish.runner.add(name, runner)</a>|Adds a runner to the table of available runners. If runner is a table,| |<a href="#add">add(name, runner)</a>|Adds a runner to the table of available runners. If runner is a table,|
|<a href="#get">hilbish.runner.get(name)</a>|Get a runner by name.| |<a href="#get">get(name)</a>|Get a runner by name.|
|<a href="#set">hilbish.runner.set(name, runner)</a>|Sets a runner by name. The runner table must have the run function in it.| |<a href="#set">set(name, runner)</a>|Sets a runner by name. The runner table must have the run function in it.|
|<a href="#exec">hilbish.runner.exec(cmd, runnerName)</a>|Executes cmd with a runner. If runnerName isn't passed, it uses| |<a href="#exec">exec(cmd, runnerName)</a>|Executes cmd with a runner. If runnerName isn't passed, it uses|
> d)
<a href="#runner.lua" class='heading-link'>
<i class="fas fa-paperclip"></i>
</a>
</h4>
Evaluates `cmd` as Lua input. This is the same as using `dofile` Evaluates `cmd` as Lua input. This is the same as using `dofile`
or `load`, but is appropriated for the runner interface. or `load`, but is appropriated for the runner interface.