mirror of
https://github.com/Hilbis/Hilbish
synced 2025-07-06 19:12:02 +00:00
Compare commits
No commits in common. "cdd31e1c4f1e08f010a9694f19456bde84c6c05e" and "15e3c1a74b4e0c164b3ee88cf1bd51982ca39120" have entirely different histories.
cdd31e1c4f
...
15e3c1a74b
11
.github/workflows/docs.yml
vendored
11
.github/workflows/docs.yml
vendored
@ -10,18 +10,9 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
submodules: true
|
|
||||||
fetch-depth: 0
|
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
- name: Download Task
|
- name: Run docgen
|
||||||
run: 'sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d'
|
|
||||||
- name: Build
|
|
||||||
run: ./bin/task
|
|
||||||
- name: Run docgen (go-written)
|
|
||||||
run: go run cmd/docgen/docgen.go
|
run: go run cmd/docgen/docgen.go
|
||||||
- name: Run docgen (lua-written)
|
|
||||||
run: ./hilbish cmd/docgen/docgen.lua
|
|
||||||
- name: Commit new docs
|
- name: Commit new docs
|
||||||
uses: stefanzweifel/git-auto-commit-action@v4
|
uses: stefanzweifel/git-auto-commit-action@v4
|
||||||
with:
|
with:
|
||||||
|
3
api.go
3
api.go
@ -23,6 +23,7 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"hilbish/sink"
|
||||||
"hilbish/util"
|
"hilbish/util"
|
||||||
|
|
||||||
rt "github.com/arnodel/golua/runtime"
|
rt "github.com/arnodel/golua/runtime"
|
||||||
@ -132,7 +133,7 @@ func hilbishLoad(rtm *rt.Runtime) (rt.Value, func()) {
|
|||||||
pluginModule := moduleLoader(rtm)
|
pluginModule := moduleLoader(rtm)
|
||||||
mod.Set(rt.StringValue("module"), rt.TableValue(pluginModule))
|
mod.Set(rt.StringValue("module"), rt.TableValue(pluginModule))
|
||||||
|
|
||||||
sinkModule := util.SinkLoader(l)
|
sinkModule := sink.Loader(l)
|
||||||
mod.Set(rt.StringValue("sink"), rt.TableValue(sinkModule))
|
mod.Set(rt.StringValue("sink"), rt.TableValue(sinkModule))
|
||||||
|
|
||||||
return rt.TableValue(mod), nil
|
return rt.TableValue(mod), nil
|
||||||
|
@ -299,25 +299,7 @@ start:
|
|||||||
func main() {
|
func main() {
|
||||||
fset := token.NewFileSet()
|
fset := token.NewFileSet()
|
||||||
os.Mkdir("docs", 0777)
|
os.Mkdir("docs", 0777)
|
||||||
os.RemoveAll("docs/api")
|
|
||||||
os.Mkdir("docs/api", 0777)
|
os.Mkdir("docs/api", 0777)
|
||||||
|
|
||||||
f, err := os.Create("docs/api/_index.md")
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
f.WriteString(`---
|
|
||||||
title: API
|
|
||||||
layout: doc
|
|
||||||
weight: -100
|
|
||||||
menu: docs
|
|
||||||
---
|
|
||||||
|
|
||||||
Welcome to the API documentation for Hilbish. This documents Lua functions
|
|
||||||
provided by Hilbish.
|
|
||||||
`)
|
|
||||||
f.Close()
|
|
||||||
|
|
||||||
os.Mkdir("emmyLuaDocs", 0777)
|
os.Mkdir("emmyLuaDocs", 0777)
|
||||||
|
|
||||||
dirs := []string{"./"}
|
dirs := []string{"./"}
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
local fs = require 'fs'
|
local fs = require 'fs'
|
||||||
local emmyPattern = '^%-%-%- (.+)'
|
local emmyPattern = '^%-%-%- (.+)'
|
||||||
local emmyPattern2 = '^%-%- (.+)'
|
local modpattern = '^%-+ @module (%w+)'
|
||||||
local modpattern = '^%-+ @module (.+)'
|
|
||||||
local pieces = {}
|
local pieces = {}
|
||||||
local descriptions = {}
|
|
||||||
|
|
||||||
local files = fs.readdir 'nature'
|
local files = fs.readdir 'nature'
|
||||||
for _, fname in ipairs(files) do
|
for _, fname in ipairs(files) do
|
||||||
@ -17,24 +15,16 @@ for _, fname in ipairs(files) do
|
|||||||
|
|
||||||
print(fname, mod)
|
print(fname, mod)
|
||||||
pieces[mod] = {}
|
pieces[mod] = {}
|
||||||
descriptions[mod] = {}
|
|
||||||
|
|
||||||
local docPiece = {}
|
local docPiece = {}
|
||||||
local lines = {}
|
local lines = {}
|
||||||
local lineno = 0
|
local lineno = 0
|
||||||
local doingDescription = true
|
|
||||||
|
|
||||||
for line in f:lines() do
|
for line in f:lines() do
|
||||||
lineno = lineno + 1
|
lineno = lineno + 1
|
||||||
lines[lineno] = line
|
lines[lineno] = line
|
||||||
|
|
||||||
if line == header then goto continue2 end
|
if line == header then goto continue2 end
|
||||||
if line:match(emmyPattern) or line:match(emmyPattern2) then
|
if not line:match(emmyPattern) then
|
||||||
if doingDescription then
|
|
||||||
table.insert(descriptions[mod], line:match(emmyPattern) or line:match(emmyPattern2))
|
|
||||||
end
|
|
||||||
else
|
|
||||||
doingDescription = false
|
|
||||||
if line:match '^function' then
|
if line:match '^function' then
|
||||||
local pattern = (string.format('^function %s%%.', mod) .. '(%w+)')
|
local pattern = (string.format('^function %s%%.', mod) .. '(%w+)')
|
||||||
local funcName = line:match(pattern)
|
local funcName = line:match(pattern)
|
||||||
@ -59,14 +49,10 @@ for _, fname in ipairs(files) do
|
|||||||
|
|
||||||
if emmy then
|
if emmy then
|
||||||
if emmy == 'param' then
|
if emmy == 'param' then
|
||||||
print('bruh', emmythings[1], emmythings[2])
|
|
||||||
table.insert(dps.params, 1, {
|
table.insert(dps.params, 1, {
|
||||||
name = emmythings[1],
|
name = emmythings[1],
|
||||||
type = emmythings[2],
|
type = emmythings[2]
|
||||||
-- the +1 accounts for space.
|
|
||||||
description = table.concat(emmythings, ' '):sub(emmythings[1]:len() + 1 + emmythings[2]:len() + 1)
|
|
||||||
})
|
})
|
||||||
print(table.concat(emmythings, '/'))
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
table.insert(dps.description, 1, docline)
|
table.insert(dps.description, 1, docline)
|
||||||
@ -95,78 +81,29 @@ description: %s
|
|||||||
layout: doc
|
layout: doc
|
||||||
menu:
|
menu:
|
||||||
docs:
|
docs:
|
||||||
parent: "%s"
|
parent: "Nature"
|
||||||
---
|
---
|
||||||
|
|
||||||
]]
|
]]
|
||||||
|
|
||||||
for iface, dps in pairs(pieces) do
|
for iface, dps in pairs(pieces) do
|
||||||
local mod = iface:match '(%w+)%.' or 'nature'
|
local mod = iface:match '(%w+)%.' or 'nature'
|
||||||
local docParent = 'Nature'
|
local path = string.format('docs/%s/%s.md', mod, iface)
|
||||||
|
|
||||||
path = string.format('docs/%s/%s.md', mod, iface)
|
|
||||||
if mod ~= 'nature' then
|
|
||||||
docParent = "API"
|
|
||||||
path = string.format('docs/api/%s/%s.md', mod, iface)
|
|
||||||
end
|
|
||||||
|
|
||||||
fs.mkdir(fs.dir(path), true)
|
fs.mkdir(fs.dir(path), true)
|
||||||
|
local f <close> = io.open(path, 'w')
|
||||||
local exists = pcall(fs.stat, path)
|
f:write(string.format(header, 'Module', iface, 'No description.'))
|
||||||
local newOrNotNature = exists and mod ~= 'nature'
|
|
||||||
|
|
||||||
local f <close> = io.open(path, newOrNotNature and 'r+' or 'w+')
|
|
||||||
local tocPos
|
|
||||||
if not newOrNotNature then
|
|
||||||
f:write(string.format(header, 'Module', iface, (descriptions[iface] and #descriptions[iface] > 0) and descriptions[iface][1] or 'No description.', docParent))
|
|
||||||
if descriptions[iface] and #descriptions[iface] > 0 then
|
|
||||||
table.remove(descriptions[iface], 1)
|
|
||||||
f:write(string.format('\n## Introduction\n%s\n\n', table.concat(descriptions[iface], '\n')))
|
|
||||||
f:write('## Functions\n')
|
|
||||||
f:write([[|||
|
|
||||||
|----|----|
|
|
||||||
]])
|
|
||||||
tocPos = f:seek()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
print(f)
|
print(f)
|
||||||
|
|
||||||
print('mod and path:', mod, path)
|
print(mod, path)
|
||||||
|
|
||||||
local tocSearch = false
|
|
||||||
for line in f:lines() do
|
|
||||||
if line:match '^## Functions' then
|
|
||||||
tocSearch = true
|
|
||||||
end
|
|
||||||
if tocSearch and line == '' then
|
|
||||||
tocSearch = false
|
|
||||||
tocPos = f:seek() - 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
for func, docs in pairs(dps) do
|
for func, docs in pairs(dps) do
|
||||||
|
f:write(string.format('<hr>\n<div id=\'%s\'>', func))
|
||||||
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('%?$', '')))
|
||||||
params = params .. param.name:gsub('%?$', '')
|
if idx ~= #docs.params then sig = sig .. ', ' end
|
||||||
if idx ~= #docs.params then
|
|
||||||
sig = sig .. ', '
|
|
||||||
params = params .. ', '
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
sig = sig .. ')'
|
sig = sig .. ')'
|
||||||
|
|
||||||
if tocPos then
|
|
||||||
f:seek('set', tocPos)
|
|
||||||
local contents = f:read '*a'
|
|
||||||
f:seek('set', tocPos)
|
|
||||||
local tocLine = string.format('|<a href="#%s">%s</a>|%s|\n', func, string.format('%s(%s)', func, params), docs.description[1])
|
|
||||||
f:write(tocLine .. contents)
|
|
||||||
f:seek 'end'
|
|
||||||
end
|
|
||||||
|
|
||||||
f:write(string.format('<hr>\n<div id=\'%s\'>\n', func))
|
|
||||||
f:write(string.format([[
|
f:write(string.format([[
|
||||||
<h4 class='heading'>
|
<h4 class='heading'>
|
||||||
%s
|
%s
|
||||||
@ -184,7 +121,6 @@ for iface, dps in pairs(pieces) do
|
|||||||
end
|
end
|
||||||
for _, param in ipairs(docs.params) do
|
for _, param in ipairs(docs.params) do
|
||||||
f:write(string.format('`%s` **`%s`**\n', param.name:gsub('%?$', ''), param.type))
|
f:write(string.format('`%s` **`%s`**\n', param.name:gsub('%?$', ''), param.type))
|
||||||
f:write(string.format('%s\n\n', param.description))
|
|
||||||
end
|
end
|
||||||
--[[
|
--[[
|
||||||
local params = table.filter(docs, function(t)
|
local params = table.filter(docs, function(t)
|
||||||
|
@ -53,39 +53,8 @@ which follows XDG on Linux and MacOS, and is located in %APPDATA% on Windows.
|
|||||||
As the directory is usually `~/.config` on Linux, you can run this command to copy it:
|
As the directory is usually `~/.config` on Linux, you can run this command to copy it:
|
||||||
`cp /usr/share/hilbish/.hilbishrc.lua ~/.config/hilbish/init.lua`
|
`cp /usr/share/hilbish/.hilbishrc.lua ~/.config/hilbish/init.lua`
|
||||||
|
|
||||||
Now we can get to customization!
|
Now you can get to editing it. Since it's just a Lua file, having basic
|
||||||
|
knowledge of Lua would help. All of Lua's standard libraries and functions
|
||||||
If we closely examine a small snippet of the default config:
|
from Lua 5.4 are available. Hilbish has some custom and modules that are
|
||||||
```lua
|
available. To see them, you can run the `doc` command. This also works as
|
||||||
-- Default Hilbish config
|
general documentation for other things.
|
||||||
-- .. with some omitted code .. --
|
|
||||||
|
|
||||||
local function doPrompt(fail)
|
|
||||||
hilbish.prompt(lunacolors.format(
|
|
||||||
'{blue}%u {cyan}%d ' .. (fail and '{red}' or '{green}') .. '∆ '
|
|
||||||
))
|
|
||||||
end
|
|
||||||
|
|
||||||
doPrompt()
|
|
||||||
|
|
||||||
bait.catch('command.exit', function(code)
|
|
||||||
doPrompt(code ~= 0)
|
|
||||||
end)
|
|
||||||
```
|
|
||||||
|
|
||||||
We see a whopping **three** Hilbish libraries being used in this part of code.
|
|
||||||
First is of course, named after the shell itself, [`hilbish`](../api/hilbish). This is kind of a
|
|
||||||
"catch-all" namespace for functions that directly related to shell functionality/settings.
|
|
||||||
|
|
||||||
And as we can see, the [hilbish.prompt](../api/hilbish/#prompt) function is used
|
|
||||||
to change our prompt. Change our prompt to what, exactly?
|
|
||||||
|
|
||||||
The doc for the function states that the verbs `%u` and `%d`are used for username and current directory
|
|
||||||
of the shell, respectively.
|
|
||||||
|
|
||||||
We wrap this in the [`lunacolors.format`](../lunacolors) function, to give
|
|
||||||
our prompt some nice color.
|
|
||||||
|
|
||||||
But you might have also noticed that this is in the `doPrompt` function, which is called once,
|
|
||||||
and then used again in a [bait](../api/bait) hook. Specifically, the `command.exit` hook,
|
|
||||||
which is called after a command exits, so when it finishes running.
|
|
||||||
|
@ -1,25 +1,12 @@
|
|||||||
---
|
---
|
||||||
title: Module dirs
|
title: Module dirs
|
||||||
description: internal directory management
|
description: No description.
|
||||||
layout: doc
|
layout: doc
|
||||||
menu:
|
menu:
|
||||||
docs:
|
docs:
|
||||||
parent: "Nature"
|
parent: "Nature"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
## Introduction
|
|
||||||
The dirs module defines a small set of functions to store and manage
|
|
||||||
directories.
|
|
||||||
|
|
||||||
## Functions
|
|
||||||
|||
|
|
||||||
|----|----|
|
|
||||||
|<a href="#recent">recent(idx)</a>|Get entry from recent directories list based on index.|
|
|
||||||
|<a href="#pop">pop(num)</a>|Remove the specified amount of dirs from the recent directories list.|
|
|
||||||
|<a href="#peak">peak(num)</a>|Look at `num` amount of recent directories, starting from the latest.|
|
|
||||||
|<a href="#push">push(dir)</a>|Add `dir` to the recent directories list.|
|
|
||||||
|<a href="#setOld">setOld(d)</a>|Sets the old directory string.|
|
|
||||||
<hr>
|
<hr>
|
||||||
<div id='setOld'>
|
<div id='setOld'>
|
||||||
<h4 class='heading'>
|
<h4 class='heading'>
|
||||||
@ -32,24 +19,20 @@ dirs.setOld(d)
|
|||||||
Sets the old directory string.
|
Sets the old directory string.
|
||||||
#### Parameters
|
#### Parameters
|
||||||
`d` **`string`**
|
`d` **`string`**
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
<div id='push'>
|
<div id='push'>
|
||||||
<h4 class='heading'>
|
<h4 class='heading'>
|
||||||
dirs.push(dir)
|
dirs.push()
|
||||||
<a href="#push" class='heading-link'>
|
<a href="#push" class='heading-link'>
|
||||||
<i class="fas fa-paperclip"></i>
|
<i class="fas fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
|
||||||
Add `dir` to the recent directories list.
|
Add `d` to the recent directories list.
|
||||||
#### Parameters
|
#### Parameters
|
||||||
`dir` **`string`**
|
This function has no parameters.
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
@ -62,11 +45,8 @@ dirs.peak(num)
|
|||||||
</h4>
|
</h4>
|
||||||
|
|
||||||
Look at `num` amount of recent directories, starting from the latest.
|
Look at `num` amount of recent directories, starting from the latest.
|
||||||
This returns a table of recent directories, up to the `num` amount.
|
|
||||||
#### Parameters
|
#### Parameters
|
||||||
`num` **`number`**
|
`num` **`number`**
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
@ -81,8 +61,6 @@ dirs.pop(num)
|
|||||||
Remove the specified amount of dirs from the recent directories list.
|
Remove the specified amount of dirs from the recent directories list.
|
||||||
#### Parameters
|
#### Parameters
|
||||||
`num` **`number`**
|
`num` **`number`**
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
@ -97,7 +75,5 @@ dirs.recent(idx)
|
|||||||
Get entry from recent directories list based on index.
|
Get entry from recent directories list based on index.
|
||||||
#### Parameters
|
#### Parameters
|
||||||
`idx` **`number`**
|
`idx` **`number`**
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1,76 +0,0 @@
|
|||||||
---
|
|
||||||
title: Module doc
|
|
||||||
description: command-line doc rendering
|
|
||||||
layout: doc
|
|
||||||
menu:
|
|
||||||
docs:
|
|
||||||
parent: "Nature"
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
## Introduction
|
|
||||||
The doc module contains a small set of functions
|
|
||||||
used by the Greenhouse pager to render parts of the documentation pages.
|
|
||||||
This is only documented for the sake of it. It's only intended use
|
|
||||||
is by the Greenhouse pager.
|
|
||||||
|
|
||||||
## Functions
|
|
||||||
|||
|
|
||||||
|----|----|
|
|
||||||
|<a href="#renderCodeBlock">renderCodeBlock(text)</a>|Assembles and renders a code block. This returns|
|
|
||||||
|<a href="#highlight">highlight(text)</a>|Performs basic Lua code highlighting.|
|
|
||||||
|<a href="#renderInfoBlock">renderInfoBlock(type, text)</a>|Renders an info block. An info block is a block of text with|
|
|
||||||
<hr>
|
|
||||||
<div id='renderInfoBlock'>
|
|
||||||
<h4 class='heading'>
|
|
||||||
doc.renderInfoBlock(type, text)
|
|
||||||
<a href="#renderInfoBlock" class='heading-link'>
|
|
||||||
<i class="fas fa-paperclip"></i>
|
|
||||||
</a>
|
|
||||||
</h4>
|
|
||||||
|
|
||||||
Renders an info block. An info block is a block of text with
|
|
||||||
an icon and styled text block.
|
|
||||||
#### Parameters
|
|
||||||
`type` **`string`**
|
|
||||||
Type of info block. The only one specially styled is the `warning`.
|
|
||||||
|
|
||||||
`text` **`string`**
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
<div id='highlight'>
|
|
||||||
<h4 class='heading'>
|
|
||||||
doc.highlight(text)
|
|
||||||
<a href="#highlight" class='heading-link'>
|
|
||||||
<i class="fas fa-paperclip"></i>
|
|
||||||
</a>
|
|
||||||
</h4>
|
|
||||||
|
|
||||||
Performs basic Lua code highlighting.
|
|
||||||
#### Parameters
|
|
||||||
`text` **`string`**
|
|
||||||
Code/text to do highlighting on.
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
<div id='renderCodeBlock'>
|
|
||||||
<h4 class='heading'>
|
|
||||||
doc.renderCodeBlock(text)
|
|
||||||
<a href="#renderCodeBlock" class='heading-link'>
|
|
||||||
<i class="fas fa-paperclip"></i>
|
|
||||||
</a>
|
|
||||||
</h4>
|
|
||||||
|
|
||||||
Assembles and renders a code block. This returns
|
|
||||||
the supplied text based on the number of command line columns,
|
|
||||||
and styles it to resemble a code block.
|
|
||||||
#### Parameters
|
|
||||||
`text` **`string`**
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
@ -6,6 +6,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"hilbish/sink"
|
||||||
"hilbish/util"
|
"hilbish/util"
|
||||||
|
|
||||||
rt "github.com/arnodel/golua/runtime"
|
rt "github.com/arnodel/golua/runtime"
|
||||||
@ -138,7 +139,7 @@ func handleStream(v rt.Value, strms *util.Streams, errStream, inStream bool) err
|
|||||||
varstrm = f.Handle()
|
varstrm = f.Handle()
|
||||||
}
|
}
|
||||||
|
|
||||||
if f, ok := val.(*util.Sink); ok {
|
if f, ok := val.(*sink.Sink); ok {
|
||||||
varstrm = f.Rw
|
varstrm = f.Rw
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"hilbish/sink"
|
||||||
"hilbish/util"
|
"hilbish/util"
|
||||||
|
|
||||||
rt "github.com/arnodel/golua/runtime"
|
rt "github.com/arnodel/golua/runtime"
|
||||||
@ -117,9 +118,9 @@ func (s *snail) Run(cmd string, strms *util.Streams) (bool, io.Writer, io.Writer
|
|||||||
cmds[k.AsString()] = v.AsTable().Get(rt.StringValue("exec")).AsClosure()
|
cmds[k.AsString()] = v.AsTable().Get(rt.StringValue("exec")).AsClosure()
|
||||||
})
|
})
|
||||||
if cmd := cmds[args[0]]; cmd != nil {
|
if cmd := cmds[args[0]]; cmd != nil {
|
||||||
stdin := util.NewSinkInput(s.runtime, hc.Stdin)
|
stdin := sink.NewSinkInput(s.runtime, hc.Stdin)
|
||||||
stdout := util.NewSinkOutput(s.runtime, hc.Stdout)
|
stdout := sink.NewSinkOutput(s.runtime, hc.Stdout)
|
||||||
stderr := util.NewSinkOutput(s.runtime, hc.Stderr)
|
stderr := sink.NewSinkOutput(s.runtime, hc.Stderr)
|
||||||
|
|
||||||
sinks := rt.NewTable()
|
sinks := rt.NewTable()
|
||||||
sinks.Set(rt.StringValue("in"), rt.UserDataValue(stdin.UserData))
|
sinks.Set(rt.StringValue("in"), rt.UserDataValue(stdin.UserData))
|
||||||
|
3
lua.go
3
lua.go
@ -3,7 +3,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
|
||||||
|
|
||||||
"hilbish/util"
|
"hilbish/util"
|
||||||
"hilbish/golibs/bait"
|
"hilbish/golibs/bait"
|
||||||
@ -64,7 +63,7 @@ func luaInit() {
|
|||||||
|
|
||||||
err1 := util.DoFile(l, "nature/init.lua")
|
err1 := util.DoFile(l, "nature/init.lua")
|
||||||
if err1 != nil {
|
if err1 != nil {
|
||||||
err2 := util.DoFile(l, filepath.Join(dataDir, "nature", "init.lua"))
|
err2 := util.DoFile(l, preloadPath)
|
||||||
if err2 != nil {
|
if err2 != nil {
|
||||||
fmt.Fprintln(os.Stderr, "Missing nature module, some functionality and builtins will be missing.")
|
fmt.Fprintln(os.Stderr, "Missing nature module, some functionality and builtins will be missing.")
|
||||||
fmt.Fprintln(os.Stderr, "local error:", err1)
|
fmt.Fprintln(os.Stderr, "local error:", err1)
|
||||||
|
26
main.go
26
main.go
@ -40,24 +40,11 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
if runtime.GOOS == "linux" {
|
|
||||||
// dataDir should only be empty on linux to allow XDG_DATA_DIRS searching.
|
|
||||||
// but since it might be set on some distros (nixos) we should still check if its really is empty.
|
|
||||||
if dataDir == "" {
|
|
||||||
searchableDirs := getenv("XDG_DATA_DIRS", "/usr/local/share/:/usr/share/")
|
|
||||||
dataDir = "."
|
|
||||||
for _, path := range strings.Split(searchableDirs, ":") {
|
|
||||||
_, err := os.Stat(filepath.Join(path, "hilbish", ".hilbishrc.lua"))
|
|
||||||
if err == nil {
|
|
||||||
dataDir = filepath.Join(path, "hilbish")
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
curuser, _ = user.Current()
|
curuser, _ = user.Current()
|
||||||
|
homedir := curuser.HomeDir
|
||||||
confDir, _ = os.UserConfigDir()
|
confDir, _ = os.UserConfigDir()
|
||||||
|
preloadPath = strings.Replace(preloadPath, "~", homedir, 1)
|
||||||
|
sampleConfPath = strings.Replace(sampleConfPath, "~", homedir, 1)
|
||||||
|
|
||||||
// i honestly dont know what directories to use for this
|
// i honestly dont know what directories to use for this
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
@ -151,11 +138,10 @@ func main() {
|
|||||||
confpath := ".hilbishrc.lua"
|
confpath := ".hilbishrc.lua"
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// If it wasnt found, go to the real sample conf
|
// If it wasnt found, go to the real sample conf
|
||||||
sampleConfigPath := filepath.Join(dataDir, ".hilbishrc.lua")
|
_, err = os.ReadFile(sampleConfPath)
|
||||||
_, err = os.ReadFile(sampleConfigPath)
|
confpath = sampleConfPath
|
||||||
confpath = sampleConfigPath
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("could not find .hilbishrc.lua or", sampleConfigPath)
|
fmt.Println("could not find .hilbishrc.lua or", sampleConfPath)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
-- @module dirs
|
-- @module dirs
|
||||||
-- internal directory management
|
|
||||||
-- The dirs module defines a small set of functions to store and manage
|
|
||||||
-- directories.
|
|
||||||
local bait = require 'bait'
|
local bait = require 'bait'
|
||||||
local fs = require 'fs'
|
local fs = require 'fs'
|
||||||
|
|
||||||
local dirs = {}
|
local dirs = {}
|
||||||
|
|
||||||
--- Last (current working) directory. Separate from recentDirs mainly for easier use.
|
--- Last (current working) directory. Separate from recentDirs mainly for
|
||||||
|
--- easier use.
|
||||||
dirs.old = ''
|
dirs.old = ''
|
||||||
--- Table of recent directories. For use, look at public functions.
|
--- Table of recent directories. For use, look at public functions.
|
||||||
dirs.recentDirs = {}
|
dirs.recentDirs = {}
|
||||||
@ -38,15 +36,13 @@ function dirRecents(num, remove)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Look at `num` amount of recent directories, starting from the latest.
|
--- Look at `num` amount of recent directories, starting from the latest.
|
||||||
--- This returns a table of recent directories, up to the `num` amount.
|
|
||||||
-- @param num? number
|
-- @param num? number
|
||||||
function dirs.peak(num)
|
function dirs.peak(num)
|
||||||
return dirRecents(num)
|
return dirRecents(num)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Add `dir` to the recent directories list.
|
--- Add `d` to the recent directories list.
|
||||||
--- @param dir string
|
function dirs.push(d)
|
||||||
function dirs.push(dir)
|
|
||||||
dirs.recentDirs[dirs.recentSize + 1] = nil
|
dirs.recentDirs[dirs.recentSize + 1] = nil
|
||||||
if dirs.recentDirs[#dirs.recentDirs - 1] ~= d then
|
if dirs.recentDirs[#dirs.recentDirs - 1] ~= d then
|
||||||
ok, d = pcall(fs.abs, d)
|
ok, d = pcall(fs.abs, d)
|
||||||
|
@ -1,25 +1,13 @@
|
|||||||
-- @module doc
|
|
||||||
-- command-line doc rendering
|
|
||||||
-- The doc module contains a small set of functions
|
|
||||||
-- used by the Greenhouse pager to render parts of the documentation pages.
|
|
||||||
-- This is only documented for the sake of it. It's only intended use
|
|
||||||
-- is by the Greenhouse pager.
|
|
||||||
local lunacolors = require 'lunacolors'
|
local lunacolors = require 'lunacolors'
|
||||||
|
|
||||||
local doc = {}
|
local M = {}
|
||||||
|
|
||||||
--- Performs basic Lua code highlighting.
|
function M.highlight(text)
|
||||||
--- @param text string Code/text to do highlighting on.
|
|
||||||
function doc.highlight(text)
|
|
||||||
return text:gsub('\'.-\'', lunacolors.yellow)
|
return text:gsub('\'.-\'', lunacolors.yellow)
|
||||||
--:gsub('%-%- .-', lunacolors.black)
|
--:gsub('%-%- .-', lunacolors.black)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Assembles and renders a code block. This returns
|
function M.renderCodeBlock(text)
|
||||||
--- the supplied text based on the number of command line columns,
|
|
||||||
--- and styles it to resemble a code block.
|
|
||||||
--- @param text string
|
|
||||||
function doc.renderCodeBlock(text)
|
|
||||||
local longest = 0
|
local longest = 0
|
||||||
local lines = string.split(text:gsub('\t', ' '), '\n')
|
local lines = string.split(text:gsub('\t', ' '), '\n')
|
||||||
|
|
||||||
@ -29,18 +17,14 @@ function doc.renderCodeBlock(text)
|
|||||||
end
|
end
|
||||||
|
|
||||||
for i, line in ipairs(lines) do
|
for i, line in ipairs(lines) do
|
||||||
lines[i] = lunacolors.format('{greyBg}' .. ' ' .. doc.highlight(line:sub(0, longest))
|
lines[i] = lunacolors.format('{greyBg}' .. ' ' .. M.highlight(line:sub(0, longest))
|
||||||
.. string.rep(' ', longest - line:len()) .. ' ')
|
.. string.rep(' ', longest - line:len()) .. ' ')
|
||||||
end
|
end
|
||||||
|
|
||||||
return '\n' .. lunacolors.format('{greyBg}' .. table.concat(lines, '\n')) .. '\n'
|
return '\n' .. lunacolors.format('{greyBg}' .. table.concat(lines, '\n')) .. '\n'
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Renders an info block. An info block is a block of text with
|
function M.renderInfoBlock(type, text)
|
||||||
--- an icon and styled text block.
|
|
||||||
--- @param type string Type of info block. The only one specially styled is the `warning`.
|
|
||||||
--- @param text string
|
|
||||||
function doc.renderInfoBlock(type, text)
|
|
||||||
local longest = 0
|
local longest = 0
|
||||||
local lines = string.split(text:gsub('\t', ' '), '\n')
|
local lines = string.split(text:gsub('\t', ' '), '\n')
|
||||||
|
|
||||||
@ -50,7 +34,7 @@ function doc.renderInfoBlock(type, text)
|
|||||||
end
|
end
|
||||||
|
|
||||||
for i, line in ipairs(lines) do
|
for i, line in ipairs(lines) do
|
||||||
lines[i] = ' ' .. doc.highlight(line:sub(0, longest))
|
lines[i] = ' ' .. M.highlight(line:sub(0, longest))
|
||||||
.. string.rep(' ', longest - line:len()) .. ' '
|
.. string.rep(' ', longest - line:len()) .. ' '
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -60,4 +44,4 @@ function doc.renderInfoBlock(type, text)
|
|||||||
end
|
end
|
||||||
return '\n' .. heading .. '\n' .. lunacolors.format('{greyBg}' .. table.concat(lines, '\n')) .. '\n'
|
return '\n' .. heading .. '\n' .. lunacolors.format('{greyBg}' .. table.concat(lines, '\n')) .. '\n'
|
||||||
end
|
end
|
||||||
return doc
|
return M
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
-- @module greenhouse
|
-- Greenhouse is a simple text scrolling handler for terminal programs.
|
||||||
-- Greenhouse is a simple text scrolling handler (pager) for terminal programs.
|
|
||||||
-- The idea is that it can be set a region to do its scrolling and paging
|
-- The idea is that it can be set a region to do its scrolling and paging
|
||||||
-- job and then the user can draw whatever outside it.
|
-- job and then the user can draw whatever outside it.
|
||||||
-- This reduces code duplication for the message viewer
|
-- This reduces code duplication for the message viewer
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
-- @module greenhouse.page
|
|
||||||
local Object = require 'nature.object'
|
local Object = require 'nature.object'
|
||||||
|
|
||||||
local Page = Object:extend()
|
local Page = Object:extend()
|
||||||
@ -11,7 +10,6 @@ function Page:new(title, text)
|
|||||||
self.children = {}
|
self.children = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function Page:setText(text)
|
function Page:setText(text)
|
||||||
self.lines = string.split(text, '\n')
|
self.lines = string.split(text, '\n')
|
||||||
end
|
end
|
||||||
|
@ -1,14 +1,3 @@
|
|||||||
-- @module hilbish.messages
|
|
||||||
-- simplistic message passing
|
|
||||||
-- The messages interface defines a way for Hilbish-integrated commands,
|
|
||||||
-- user config and other tasks to send notifications to alert the user.z
|
|
||||||
-- The `hilbish.message` type is a table with the following keys:
|
|
||||||
-- `title` (string): A title for the message notification.
|
|
||||||
-- `text` (string): The contents of the message.
|
|
||||||
-- `channel` (string): States the origin of the message, `hilbish.*` is reserved for Hilbish tasks.
|
|
||||||
-- `summary` (string): A short summary of the `text`.
|
|
||||||
-- `icon` (string): Unicode (preferably standard emoji) icon for the message notification
|
|
||||||
-- `read` (boolean): Whether the full message has been read or not.
|
|
||||||
local bait = require 'bait'
|
local bait = require 'bait'
|
||||||
local commander = require 'commander'
|
local commander = require 'commander'
|
||||||
local lunacolors = require 'lunacolors'
|
local lunacolors = require 'lunacolors'
|
||||||
@ -55,8 +44,6 @@ function hilbish.messages.send(message)
|
|||||||
bait.throw('hilbish.notification', message)
|
bait.throw('hilbish.notification', message)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Marks a message at `idx` as read.
|
|
||||||
--- @param idx number
|
|
||||||
function hilbish.messages.read(idx)
|
function hilbish.messages.read(idx)
|
||||||
local msg = M._messages[idx]
|
local msg = M._messages[idx]
|
||||||
if msg then
|
if msg then
|
||||||
@ -65,20 +52,16 @@ function hilbish.messages.read(idx)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Marks all messages as read.
|
function hilbish.messages.readAll(idx)
|
||||||
function hilbish.messages.readAll()
|
|
||||||
for _, msg in ipairs(hilbish.messages.all()) do
|
for _, msg in ipairs(hilbish.messages.all()) do
|
||||||
hilbish.messages.read(msg.index)
|
hilbish.messages.read(msg.index)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Returns the amount of unread messages.
|
|
||||||
function hilbish.messages.unreadCount()
|
function hilbish.messages.unreadCount()
|
||||||
return unread
|
return unread
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Deletes the message at `idx`.
|
|
||||||
--- @param idx number
|
|
||||||
function hilbish.messages.delete(idx)
|
function hilbish.messages.delete(idx)
|
||||||
local msg = M._messages[idx]
|
local msg = M._messages[idx]
|
||||||
if not msg then
|
if not msg then
|
||||||
@ -88,14 +71,12 @@ function hilbish.messages.delete(idx)
|
|||||||
M._messages[idx] = nil
|
M._messages[idx] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Deletes all messages.
|
|
||||||
function hilbish.messages.clear()
|
function hilbish.messages.clear()
|
||||||
for _, msg in ipairs(hilbish.messages.all()) do
|
for _, msg in ipairs(hilbish.messages.all()) do
|
||||||
hilbish.messages.delete(msg.index)
|
hilbish.messages.delete(msg.index)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Returns all messages.
|
|
||||||
function hilbish.messages.all()
|
function hilbish.messages.all()
|
||||||
return M._messages
|
return M._messages
|
||||||
end
|
end
|
||||||
|
@ -2,7 +2,9 @@ local bait = require 'bait'
|
|||||||
local lunacolors = require 'lunacolors'
|
local lunacolors = require 'lunacolors'
|
||||||
|
|
||||||
hilbish.motd = [[
|
hilbish.motd = [[
|
||||||
{magenta}Hilbish{reset} blooms in the {blue}midnight.{reset}
|
Wait ... {magenta}2.3{reset} is basically the same as {red}2.2?{reset}
|
||||||
|
Erm.. {blue}Ctrl-C works for Commanders,{reset} {cyan}and the sh runner has some fixes.{reset}
|
||||||
|
Just trust me bro, this is an important bug fix release. {red}- 🌺 sammyette{reset}
|
||||||
]]
|
]]
|
||||||
|
|
||||||
bait.catch('hilbish.init', function()
|
bait.catch('hilbish.init', function()
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
-- @module hilbish.runner
|
--- hilbish.runner
|
||||||
local snail = require 'snail'
|
local snail = require 'snail'
|
||||||
|
|
||||||
local currentRunner = 'hybrid'
|
local currentRunner = 'hybrid'
|
||||||
local runners = {}
|
local runners = {}
|
||||||
|
|
||||||
@ -7,7 +8,7 @@ local runners = {}
|
|||||||
hilbish = hilbish
|
hilbish = hilbish
|
||||||
|
|
||||||
--- Get a runner by name.
|
--- Get a runner by name.
|
||||||
--- @param name string Name of the runner to retrieve.
|
--- @param name string
|
||||||
--- @return table
|
--- @return table
|
||||||
function hilbish.runner.get(name)
|
function hilbish.runner.get(name)
|
||||||
local r = runners[name]
|
local r = runners[name]
|
||||||
@ -19,9 +20,9 @@ function hilbish.runner.get(name)
|
|||||||
return r
|
return r
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Adds a runner to the table of available runners.
|
--- Adds a runner to the table of available runners. If runner is a table,
|
||||||
--- If runner is a table, it must have the run function in it.
|
--- it must have the run function in it.
|
||||||
--- @param name string Name of the runner
|
--- @param name string
|
||||||
--- @param runner function | table
|
--- @param runner function | table
|
||||||
function hilbish.runner.add(name, runner)
|
function hilbish.runner.add(name, runner)
|
||||||
if type(name) ~= 'string' then
|
if type(name) ~= 'string' then
|
||||||
@ -43,9 +44,7 @@ function hilbish.runner.add(name, runner)
|
|||||||
hilbish.runner.set(name, runner)
|
hilbish.runner.set(name, runner)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- *Sets* a runner by name. The difference between this function and
|
--- Sets a runner by name. The runner table must have the run function in it.
|
||||||
--- add, is set will *not* check if the named runner exists.
|
|
||||||
--- The runner table must have the run function in it.
|
|
||||||
--- @param name string
|
--- @param name string
|
||||||
--- @param runner table
|
--- @param runner table
|
||||||
function hilbish.runner.set(name, runner)
|
function hilbish.runner.set(name, runner)
|
||||||
@ -56,11 +55,11 @@ function hilbish.runner.set(name, runner)
|
|||||||
runners[name] = runner
|
runners[name] = runner
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Executes `cmd` with a runner.
|
--- Executes cmd with a runner. If runnerName isn't passed, it uses
|
||||||
--- If `runnerName` is not specified, it uses the default Hilbish runner.
|
--- the user's current runner.
|
||||||
--- @param cmd string
|
--- @param cmd string
|
||||||
--- @param runnerName string?
|
--- @param runnerName string?
|
||||||
--- @return table
|
--- @return string, number, string
|
||||||
function hilbish.runner.exec(cmd, runnerName)
|
function hilbish.runner.exec(cmd, runnerName)
|
||||||
if not runnerName then runnerName = currentRunner end
|
if not runnerName then runnerName = currentRunner end
|
||||||
|
|
||||||
@ -69,7 +68,7 @@ function hilbish.runner.exec(cmd, runnerName)
|
|||||||
return r.run(cmd)
|
return r.run(cmd)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Sets Hilbish's runner mode by name.
|
--- Sets the current interactive/command line runner mode.
|
||||||
--- @param name string
|
--- @param name string
|
||||||
function hilbish.runner.setCurrent(name)
|
function hilbish.runner.setCurrent(name)
|
||||||
local r = hilbish.runner.get(name)
|
local r = hilbish.runner.get(name)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package util
|
package sink
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
@ -8,6 +8,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"hilbish/util"
|
||||||
|
|
||||||
rt "github.com/arnodel/golua/runtime"
|
rt "github.com/arnodel/golua/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -23,11 +25,11 @@ type Sink struct{
|
|||||||
autoFlush bool
|
autoFlush bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func SinkLoader(rtm *rt.Runtime) *rt.Table {
|
func Loader(rtm *rt.Runtime) *rt.Table {
|
||||||
sinkMeta := rt.NewTable()
|
sinkMeta := rt.NewTable()
|
||||||
|
|
||||||
sinkMethods := rt.NewTable()
|
sinkMethods := rt.NewTable()
|
||||||
sinkFuncs := map[string]LuaExport{
|
sinkFuncs := map[string]util.LuaExport{
|
||||||
"flush": {luaSinkFlush, 1, false},
|
"flush": {luaSinkFlush, 1, false},
|
||||||
"read": {luaSinkRead, 1, false},
|
"read": {luaSinkRead, 1, false},
|
||||||
"readAll": {luaSinkReadAll, 1, false},
|
"readAll": {luaSinkReadAll, 1, false},
|
||||||
@ -35,7 +37,7 @@ func SinkLoader(rtm *rt.Runtime) *rt.Table {
|
|||||||
"write": {luaSinkWrite, 2, false},
|
"write": {luaSinkWrite, 2, false},
|
||||||
"writeln": {luaSinkWriteln, 2, false},
|
"writeln": {luaSinkWriteln, 2, false},
|
||||||
}
|
}
|
||||||
SetExports(rtm, sinkMethods, sinkFuncs)
|
util.SetExports(rtm, sinkMethods, sinkFuncs)
|
||||||
|
|
||||||
sinkIndex := func(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
|
sinkIndex := func(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
|
||||||
s, _ := sinkArg(c, 0)
|
s, _ := sinkArg(c, 0)
|
||||||
@ -64,12 +66,12 @@ func SinkLoader(rtm *rt.Runtime) *rt.Table {
|
|||||||
sinkMeta.Set(rt.StringValue("__index"), rt.FunctionValue(rt.NewGoFunction(sinkIndex, "__index", 2, false)))
|
sinkMeta.Set(rt.StringValue("__index"), rt.FunctionValue(rt.NewGoFunction(sinkIndex, "__index", 2, false)))
|
||||||
rtm.SetRegistry(sinkMetaKey, rt.TableValue(sinkMeta))
|
rtm.SetRegistry(sinkMetaKey, rt.TableValue(sinkMeta))
|
||||||
|
|
||||||
exports := map[string]LuaExport{
|
exports := map[string]util.LuaExport{
|
||||||
"new": {luaSinkNew, 0, false},
|
"new": {luaSinkNew, 0, false},
|
||||||
}
|
}
|
||||||
|
|
||||||
mod := rt.NewTable()
|
mod := rt.NewTable()
|
||||||
SetExports(rtm, mod, exports)
|
util.SetExports(rtm, mod, exports)
|
||||||
|
|
||||||
return mod
|
return mod
|
||||||
}
|
}
|
@ -15,5 +15,7 @@ var (
|
|||||||
.. hilbish.userDir.config .. '/hilbish/?/?.lua;'
|
.. hilbish.userDir.config .. '/hilbish/?/?.lua;'
|
||||||
.. hilbish.userDir.config .. '/hilbish/?.lua'`
|
.. hilbish.userDir.config .. '/hilbish/?.lua'`
|
||||||
dataDir = "/usr/local/share/hilbish"
|
dataDir = "/usr/local/share/hilbish"
|
||||||
|
preloadPath = dataDir + "/nature/init.lua"
|
||||||
|
sampleConfPath = dataDir + "/.hilbishrc.lua" // Path to default/sample config
|
||||||
defaultConfDir = getenv("XDG_CONFIG_HOME", "~/.config")
|
defaultConfDir = getenv("XDG_CONFIG_HOME", "~/.config")
|
||||||
)
|
)
|
||||||
|
@ -14,6 +14,8 @@ var (
|
|||||||
.. hilbish.userDir.config .. '/hilbish/?/init.lua;'
|
.. hilbish.userDir.config .. '/hilbish/?/init.lua;'
|
||||||
.. hilbish.userDir.config .. '/hilbish/?/?.lua;'
|
.. hilbish.userDir.config .. '/hilbish/?/?.lua;'
|
||||||
.. hilbish.userDir.config .. '/hilbish/?.lua'`
|
.. hilbish.userDir.config .. '/hilbish/?.lua'`
|
||||||
dataDir = ""
|
dataDir = "/usr/local/share/hilbish"
|
||||||
|
preloadPath = dataDir + "/nature/init.lua"
|
||||||
|
sampleConfPath = dataDir + "/.hilbishrc.lua" // Path to default/sample config
|
||||||
defaultConfDir = ""
|
defaultConfDir = ""
|
||||||
)
|
)
|
||||||
|
@ -10,6 +10,8 @@ var (
|
|||||||
.. hilbish.userDir.config .. '\\Hilbish\\libs\\?\\init.lua;'
|
.. hilbish.userDir.config .. '\\Hilbish\\libs\\?\\init.lua;'
|
||||||
.. hilbish.userDir.config .. '\\Hilbish\\libs\\?\\?.lua;'
|
.. hilbish.userDir.config .. '\\Hilbish\\libs\\?\\?.lua;'
|
||||||
.. hilbish.userDir.config .. '\\Hilbish\\libs\\?.lua;'`
|
.. hilbish.userDir.config .. '\\Hilbish\\libs\\?.lua;'`
|
||||||
dataDir = util.ExpandHome("~\\Appdata\\Roaming\\Hilbish") // ~ and \, gonna cry?
|
dataDir = util.ExpandHome("~\\Appdata\\Roaming\\Hilbish") // ~ and \ gonna cry?
|
||||||
|
preloadPath = dataDir + "\\nature\\init.lua"
|
||||||
|
sampleConfPath = dataDir + "\\.hilbishrc.lua" // Path to default/sample config
|
||||||
defaultConfDir = ""
|
defaultConfDir = ""
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user