Skip to content

Commit

Permalink
fix: reduce function list to match in go generated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
TorchedSammy committed Dec 24, 2024
1 parent 5545002 commit b7af617
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
11 changes: 8 additions & 3 deletions cmd/docgen/docgen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,21 @@ for iface, dps in pairs(pieces) do

for func, docs in pairs(dps) do
local sig = string.format('%s.%s(', iface, func)
local params = ''
for idx, param in ipairs(docs.params) do
sig = sig .. ((param.name:gsub('%?$', '')))
if idx ~= #docs.params then sig = sig .. ', ' end
sig = sig .. param.name:gsub('%?$', '')
params = params .. param.name:gsub('%?$', '')
if idx ~= #docs.params then
sig = sig .. ', '
params = params .. ', '
end
end
sig = sig .. ')'

if tocPos then
local pos = f:seek()
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()
f:seek('set', pos)
end
Expand Down
18 changes: 11 additions & 7 deletions docs/api/hilbish/hilbish.runner.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,17 @@ end)
|<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.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="#setCurrent">hilbish.runner.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="#get">hilbish.runner.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="#exec">hilbish.runner.exec(cmd, runnerName)</a>|Executes cmd with a runner. If runnerName isn't passed, it uses|
>
|<a href="#getCurrent">getCurrent()</a>|Returns the current runner by name.|
|<a href="#setCurrent">setCurrent(name)</a>|Sets the current interactive/command line runner mode.|
|<a href="#add">add(name, runner)</a>|Adds a runner to the table of available runners. If runner is a table,|
|<a href="#get">get(name)</a>|Get a runner by name.|
|<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">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`
or `load`, but is appropriated for the runner interface.
Expand Down

0 comments on commit b7af617

Please sign in to comment.