mirror of https://github.com/Hilbis/Hilbish
Compare commits
6 Commits
74a6eda0f3
...
1868715b8a
Author | SHA1 | Date |
---|---|---|
sammy | 1868715b8a | |
sammy | b38585e86d | |
sammy | 3523bfa28b | |
TorchedSammy | 2c711de9dc | |
TorchedSammy | 34a652c8bd | |
TorchedSammy | f02b6528e8 |
|
@ -2,3 +2,4 @@
|
||||||
hilbish
|
hilbish
|
||||||
|
|
||||||
.vim
|
.vim
|
||||||
|
petals/
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
<h1>Hilbish</h1>
|
<h1>Hilbish</h1>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
🎀 a nice lil shell for lua people made with go and lua
|
🎀 a nice lil shell for lua people made with go and lua
|
||||||
</blockquote>
|
</blockquote><p align="center">
|
||||||
|
<a href="https://github.com/Hilbis/Hilbish/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22"><img src="https://img.shields.io/github/issues/Hilbis/Hilbish/help%20wanted?color=green" alt="help wanted"></a>
|
||||||
|
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg"></a>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
Hilbish is an interactive Unix-like shell written in Go, with the config
|
Hilbish is an interactive Unix-like shell written in Go, with the config
|
||||||
|
|
10
TODO.md
10
TODO.md
|
@ -1,10 +0,0 @@
|
||||||
- [x] Configuration
|
|
||||||
- [x] Make default config if missing
|
|
||||||
- [x] Tab completion
|
|
||||||
- [x] Custom commands via the shell
|
|
||||||
- [ ] Confirmed windows support
|
|
||||||
- [ ] Readme badges
|
|
||||||
- [x] Hooks
|
|
||||||
- [x] Aliases
|
|
||||||
- [ ] hlua (hilbish lua) - 100% lua in the hilbish interactive shell, cuz why not
|
|
||||||
- [ ] Petals (name of plugins)
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/yuin/gopher-lua"
|
"github.com/yuin/gopher-lua"
|
||||||
|
"layeh.com/gopher-luar"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Loader(L *lua.LState) int {
|
func Loader(L *lua.LState) int {
|
||||||
|
@ -22,6 +23,8 @@ func LuaErr(L *lua.LState, code int) {
|
||||||
|
|
||||||
var exports = map[string]lua.LGFunction{
|
var exports = map[string]lua.LGFunction{
|
||||||
"cd": cd,
|
"cd": cd,
|
||||||
|
"mkdir": mkdir,
|
||||||
|
"stat": stat,
|
||||||
}
|
}
|
||||||
|
|
||||||
func cd(L *lua.LState) int {
|
func cd(L *lua.LState) int {
|
||||||
|
@ -38,3 +41,21 @@ func cd(L *lua.LState) int {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func mkdir(L *lua.LState) int {
|
||||||
|
dirname := L.ToString(1)
|
||||||
|
|
||||||
|
// TODO: handle error here
|
||||||
|
os.Mkdir(strings.TrimSpace(dirname), 0744)
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func stat(L *lua.LState) int {
|
||||||
|
path := L.ToString(1)
|
||||||
|
|
||||||
|
// TODO: handle error here
|
||||||
|
pathinfo, _ := os.Stat(path)
|
||||||
|
L.Push(luar.New(L, pathinfo))
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
5
lua.go
5
lua.go
|
@ -49,7 +49,10 @@ func LuaInit(confpath string) {
|
||||||
l.PreloadModule("bait", bait.Loader)
|
l.PreloadModule("bait", bait.Loader)
|
||||||
|
|
||||||
// Add more paths that Lua can require from
|
// Add more paths that Lua can require from
|
||||||
l.DoString("package.path = package.path .. ';./libs/?/init.lua;/usr/share/hilbish/libs/?/init.lua'")
|
l.DoString(`package.path = package.path
|
||||||
|
.. ';./libs/?/init.lua;/usr/share/hilbish/libs/?/init.lua'
|
||||||
|
.. ';./?/init.lua;./?/?.lua'
|
||||||
|
`)
|
||||||
|
|
||||||
err := l.DoFile("/usr/share/hilbish/preload.lua")
|
err := l.DoFile("/usr/share/hilbish/preload.lua")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue