mirror of https://github.com/Hilbis/Hilbish
Compare commits
1 Commits
ee65a4f84b
...
3cbf80a3e5
Author | SHA1 | Date |
---|---|---|
sammyette | 3cbf80a3e5 |
|
@ -580,7 +580,7 @@ func main() {
|
||||||
}
|
}
|
||||||
if codeExample := dps.Tags["example"]; codeExample != nil {
|
if codeExample := dps.Tags["example"]; codeExample != nil {
|
||||||
f.WriteString("#### Example\n")
|
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("</div>")
|
||||||
f.WriteString("\n\n")
|
f.WriteString("\n\n")
|
||||||
|
|
|
@ -64,7 +64,7 @@ The function that will be called when the hook is thrown.
|
||||||
bait.catch('hilbish.exit', function()
|
bait.catch('hilbish.exit', function()
|
||||||
print 'Goodbye Hilbish!'
|
print 'Goodbye Hilbish!'
|
||||||
end)
|
end)
|
||||||
```
|
````
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr><div id='catchOnce'>
|
<hr><div id='catchOnce'>
|
||||||
|
@ -129,7 +129,7 @@ bait.catch('event', hookCallback)
|
||||||
-- a little while later....
|
-- a little while later....
|
||||||
bait.release('event', hookCallback)
|
bait.release('event', hookCallback)
|
||||||
-- and now hookCallback will no longer be ran for the event.
|
-- and now hookCallback will no longer be ran for the event.
|
||||||
```
|
````
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr><div id='throw'>
|
<hr><div id='throw'>
|
||||||
|
@ -158,6 +158,6 @@ bait.throw('greeting', 'world')
|
||||||
bait.catch('gretting', function(greetTo)
|
bait.catch('gretting', function(greetTo)
|
||||||
print('Hello ' .. greetTo)
|
print('Hello ' .. greetTo)
|
||||||
end)
|
end)
|
||||||
```
|
````
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,6 @@ commander.register('hello', function(args, sinks)
|
||||||
|
|
||||||
sinks.out:writeln('Hello ' .. name)
|
sinks.out:writeln('Hello ' .. name)
|
||||||
end)
|
end)
|
||||||
```
|
````
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ Pattern to compare files with.
|
||||||
local matches = fs.glob './*.lua'
|
local matches = fs.glob './*.lua'
|
||||||
print(matches)
|
print(matches)
|
||||||
-- -> {'init.lua', 'code.lua'}
|
-- -> {'init.lua', 'code.lua'}
|
||||||
```
|
````
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr><div id='join'>
|
<hr><div id='join'>
|
||||||
|
@ -145,7 +145,7 @@ Paths to join together
|
||||||
-- This prints the directory for Hilbish's config!
|
-- This prints the directory for Hilbish's config!
|
||||||
print(fs.join(hilbish.userDir.config, 'hilbish'))
|
print(fs.join(hilbish.userDir.config, 'hilbish'))
|
||||||
-- -> '/home/user/.config/hilbish' on Linux
|
-- -> '/home/user/.config/hilbish' on Linux
|
||||||
```
|
````
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr><div id='mkdir'>
|
<hr><div id='mkdir'>
|
||||||
|
@ -172,7 +172,7 @@ Whether to create parent directories for the provided name
|
||||||
#### Example
|
#### Example
|
||||||
```lua
|
```lua
|
||||||
|
|
||||||
```
|
````
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr><div id='readdir'>
|
<hr><div id='readdir'>
|
||||||
|
@ -225,6 +225,6 @@ Would print the following:
|
||||||
size = 12288
|
size = 12288
|
||||||
}
|
}
|
||||||
]]--
|
]]--
|
||||||
```
|
````
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ hilbish.alias('ga', 'git add')
|
||||||
-- Numbered substitutions are supported here!
|
-- Numbered substitutions are supported here!
|
||||||
hilbish.alias('dircount', 'ls %1 | wc -l')
|
hilbish.alias('dircount', 'ls %1 | wc -l')
|
||||||
-- "dircount ~" would count how many files are in ~ (home directory).
|
-- "dircount ~" would count how many files are in ~ (home directory).
|
||||||
```
|
````
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr><div id='appendPath'>
|
<hr><div id='appendPath'>
|
||||||
|
@ -100,7 +100,7 @@ hilbush.appendPath {
|
||||||
'~/go/bin',
|
'~/go/bin',
|
||||||
'~/.local/bin'
|
'~/.local/bin'
|
||||||
}
|
}
|
||||||
```
|
````
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr><div id='complete'>
|
<hr><div id='complete'>
|
||||||
|
@ -195,7 +195,7 @@ Note that to set a highlighter, one has to override this function.
|
||||||
function hilbish.highlighter(line)
|
function hilbish.highlighter(line)
|
||||||
return line:gsub('"%w+"', function(c) return lunacolors.green(c) end)
|
return line:gsub('"%w+"', function(c) return lunacolors.green(c) end)
|
||||||
end
|
end
|
||||||
```
|
````
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr><div id='hinter'>
|
<hr><div id='hinter'>
|
||||||
|
@ -226,7 +226,7 @@ override this function with your custom handler.
|
||||||
function hilbish.hinter(line, pos)
|
function hilbish.hinter(line, pos)
|
||||||
return 'hi'
|
return 'hi'
|
||||||
end
|
end
|
||||||
```
|
````
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr><div id='inputMode'>
|
<hr><div id='inputMode'>
|
||||||
|
@ -298,7 +298,7 @@ user ~ ∆ echo "hey
|
||||||
hey ...!
|
hey ...!
|
||||||
]]--
|
]]--
|
||||||
hilbish.multiprompt '-->'
|
hilbish.multiprompt '-->'
|
||||||
```
|
````
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr><div id='prependPath'>
|
<hr><div id='prependPath'>
|
||||||
|
@ -345,7 +345,7 @@ hilbish.prompt '%u %d ∆'
|
||||||
-- or something of old:
|
-- or something of old:
|
||||||
hilbish.prompt '%u@%h :%d $'
|
hilbish.prompt '%u@%h :%d $'
|
||||||
-- prompt: user@hostname: ~/directory $
|
-- prompt: user@hostname: ~/directory $
|
||||||
```
|
````
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr><div id='read'>
|
<hr><div id='read'>
|
||||||
|
|
|
@ -65,7 +65,7 @@ hilbish.aliases.add('hi', 'echo hi')
|
||||||
|
|
||||||
local aliases = hilbish.aliases.list()
|
local aliases = hilbish.aliases.list()
|
||||||
-- -> {hi = 'echo hi'}
|
-- -> {hi = 'echo hi'}
|
||||||
```
|
````
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr><div id='aliases.resolve'>
|
<hr><div id='aliases.resolve'>
|
||||||
|
|
|
@ -57,7 +57,7 @@ hilbish.complete('command.sudo', function(query, ctx, fields)
|
||||||
|
|
||||||
-- ... else suggest files or anything else ..
|
-- ... else suggest files or anything else ..
|
||||||
end)
|
end)
|
||||||
```
|
````
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr><div id='completion.call'>
|
<hr><div id='completion.call'>
|
||||||
|
@ -140,6 +140,6 @@ function hilbish.completion.handler(line, pos)
|
||||||
-- call command completer or files completer here
|
-- call command completer or files completer here
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
```
|
````
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ Binary to use to run the command. Does not
|
||||||
#### Example
|
#### Example
|
||||||
```lua
|
```lua
|
||||||
hilbish.jobs.add('go build', {'go', 'build'}, '/usr/bin/go')
|
hilbish.jobs.add('go build', {'go', 'build'}, '/usr/bin/go')
|
||||||
```
|
````
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr><div id='jobs.all'>
|
<hr><div id='jobs.all'>
|
||||||
|
|
|
@ -82,15 +82,14 @@ function Greenhouse:draw()
|
||||||
self.sink:write(ansikit.getCSI(self.start .. ';1', 'H'))
|
self.sink:write(ansikit.getCSI(self.start .. ';1', 'H'))
|
||||||
self.sink:write(ansikit.getCSI(2, 'J'))
|
self.sink:write(ansikit.getCSI(2, 'J'))
|
||||||
|
|
||||||
local writer = self.sink.writeln
|
|
||||||
for i = offset, offset + self.region.height - 1 do
|
for i = offset, offset + self.region.height - 1 do
|
||||||
if i > #lines then break end
|
if i > #lines then break end
|
||||||
|
|
||||||
|
local writer = self.sink.writeln
|
||||||
if i == offset + self.region.height - 1 then writer = self.sink.write end
|
if i == offset + self.region.height - 1 then writer = self.sink.write end
|
||||||
|
|
||||||
writer(self.sink, sub(lines[i]:gsub('\t', ' '), self.region.width))
|
writer(self.sink, sub(lines[i]:gsub('\t', ' '), self.region.width))
|
||||||
end
|
end
|
||||||
writer(self.sink, '\27[0m')
|
|
||||||
self:render()
|
self:render()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue