Compare commits

..

1 Commits

Author SHA1 Message Date
sammyette 3cbf80a3e5
Merge 3065cdd62d into a0513c0a05 2023-12-12 01:35:14 -07:00
9 changed files with 20 additions and 21 deletions

View File

@ -580,7 +580,7 @@ func main() {
}
if codeExample := dps.Tags["example"]; codeExample != nil {
f.WriteString("#### Example\n")
f.WriteString(fmt.Sprintf("```lua\n%s\n```\n", strings.Join(codeExample[0].fields, "\n")))
f.WriteString(fmt.Sprintf("```lua\n%s\n````\n", strings.Join(codeExample[0].fields, "\n")))
}
f.WriteString("</div>")
f.WriteString("\n\n")

View File

@ -64,7 +64,7 @@ The function that will be called when the hook is thrown.
bait.catch('hilbish.exit', function()
print 'Goodbye Hilbish!'
end)
```
````
</div>
<hr><div id='catchOnce'>
@ -129,7 +129,7 @@ bait.catch('event', hookCallback)
-- a little while later....
bait.release('event', hookCallback)
-- and now hookCallback will no longer be ran for the event.
```
````
</div>
<hr><div id='throw'>
@ -158,6 +158,6 @@ bait.throw('greeting', 'world')
bait.catch('gretting', function(greetTo)
print('Hello ' .. greetTo)
end)
```
````
</div>

View File

@ -86,6 +86,6 @@ commander.register('hello', function(args, sinks)
sinks.out:writeln('Hello ' .. name)
end)
```
````
</div>

View File

@ -122,7 +122,7 @@ Pattern to compare files with.
local matches = fs.glob './*.lua'
print(matches)
-- -> {'init.lua', 'code.lua'}
```
````
</div>
<hr><div id='join'>
@ -145,7 +145,7 @@ Paths to join together
-- This prints the directory for Hilbish's config!
print(fs.join(hilbish.userDir.config, 'hilbish'))
-- -> '/home/user/.config/hilbish' on Linux
```
````
</div>
<hr><div id='mkdir'>
@ -172,7 +172,7 @@ Whether to create parent directories for the provided name
#### Example
```lua
```
````
</div>
<hr><div id='readdir'>
@ -225,6 +225,6 @@ Would print the following:
size = 12288
}
]]--
```
````
</div>

View File

@ -72,7 +72,7 @@ hilbish.alias('ga', 'git add')
-- Numbered substitutions are supported here!
hilbish.alias('dircount', 'ls %1 | wc -l')
-- "dircount ~" would count how many files are in ~ (home directory).
```
````
</div>
<hr><div id='appendPath'>
@ -100,7 +100,7 @@ hilbush.appendPath {
'~/go/bin',
'~/.local/bin'
}
```
````
</div>
<hr><div id='complete'>
@ -195,7 +195,7 @@ Note that to set a highlighter, one has to override this function.
function hilbish.highlighter(line)
return line:gsub('"%w+"', function(c) return lunacolors.green(c) end)
end
```
````
</div>
<hr><div id='hinter'>
@ -226,7 +226,7 @@ override this function with your custom handler.
function hilbish.hinter(line, pos)
return 'hi'
end
```
````
</div>
<hr><div id='inputMode'>
@ -298,7 +298,7 @@ user ~ ∆ echo "hey
hey ...!
]]--
hilbish.multiprompt '-->'
```
````
</div>
<hr><div id='prependPath'>
@ -345,7 +345,7 @@ hilbish.prompt '%u %d ∆'
-- or something of old:
hilbish.prompt '%u@%h :%d $'
-- prompt: user@hostname: ~/directory $
```
````
</div>
<hr><div id='read'>

View File

@ -65,7 +65,7 @@ hilbish.aliases.add('hi', 'echo hi')
local aliases = hilbish.aliases.list()
-- -> {hi = 'echo hi'}
```
````
</div>
<hr><div id='aliases.resolve'>

View File

@ -57,7 +57,7 @@ hilbish.complete('command.sudo', function(query, ctx, fields)
-- ... else suggest files or anything else ..
end)
```
````
</div>
<hr><div id='completion.call'>
@ -140,6 +140,6 @@ function hilbish.completion.handler(line, pos)
-- call command completer or files completer here
end
end
```
````
</div>

View File

@ -48,7 +48,7 @@ Binary to use to run the command. Does not
#### Example
```lua
hilbish.jobs.add('go build', {'go', 'build'}, '/usr/bin/go')
```
````
</div>
<hr><div id='jobs.all'>

View File

@ -82,15 +82,14 @@ function Greenhouse:draw()
self.sink:write(ansikit.getCSI(self.start .. ';1', 'H'))
self.sink:write(ansikit.getCSI(2, 'J'))
local writer = self.sink.writeln
for i = offset, offset + self.region.height - 1 do
if i > #lines then break end
local writer = self.sink.writeln
if i == offset + self.region.height - 1 then writer = self.sink.write end
writer(self.sink, sub(lines[i]:gsub('\t', ' '), self.region.width))
end
writer(self.sink, '\27[0m')
self:render()
end