mirror of https://github.com/Hilbis/Hilbish
Compare commits
6 Commits
174d67c9e1
...
2f816c33cd
Author | SHA1 | Date |
---|---|---|
sammyette | 2f816c33cd | |
sammyette | 9b66547803 | |
sammyette | e06765abc3 | |
sammyette | 2073752e7e | |
sammyette | 84ec3d085d | |
sammyette | 97a6e4baf2 |
|
@ -10,8 +10,8 @@ a contribution. Be sure to read through it.
|
||||||
Use GitHub Issues to report any bugs or to request any features
|
Use GitHub Issues to report any bugs or to request any features
|
||||||
that may be useful to *anyone* else.
|
that may be useful to *anyone* else.
|
||||||
|
|
||||||
Check [currently open issues](https://github.com/Hilbis/Hilbish/issues)
|
Check [currently open issues](https://github.com/Rosettea/Hilbish/issues)
|
||||||
and [closed ones](https://github.com/Hilbis/Hilbish/issues?q=is%3Aissue+is%3Aclosed) to make sure someone else hasn't already made the issue.
|
and [closed ones](https://github.com/Rosettea/Hilbish/issues?q=is%3Aissue+is%3Aclosed) to make sure someone else hasn't already made the issue.
|
||||||
|
|
||||||
For bug reports, be sure to include:
|
For bug reports, be sure to include:
|
||||||
- Hilbish Version (`hilbish -v`)
|
- Hilbish Version (`hilbish -v`)
|
||||||
|
@ -40,8 +40,8 @@ your commits correctly.
|
||||||
4. Finally, make the pull request to the **dev** branch.
|
4. Finally, make the pull request to the **dev** branch.
|
||||||
|
|
||||||
## Finding Issues to Contribute to
|
## Finding Issues to Contribute to
|
||||||
You can check out the [help wanted](https://github.com/Hilbis/Hilbish/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22+)
|
You can check out the [help wanted](https://github.com/Rosettea/Hilbish/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22+)
|
||||||
labels to figure out what we need your help working on.
|
labels to figure out what we need your help working on.
|
||||||
|
|
||||||
The [up for grabs](https://github.com/Hilbis/Hilbish/issues?q=is%3Aissue+is%3Aopen+label%3A%22up+for+grabs%22+) labeled issues are low hanging fruit that should be
|
The [up for grabs](https://github.com/Rosettea/Hilbish/issues?q=is%3Aissue+is%3Aopen+label%3A%22up+for+grabs%22+) labeled issues are low hanging fruit that should be
|
||||||
easy for anyone. You can use this to get started on contributing!
|
easy for anyone. You can use this to get started on contributing!
|
||||||
|
|
|
@ -2,5 +2,9 @@ cwd() > Returns the current directory of the shell
|
||||||
|
|
||||||
flag(f) > Checks if the `f` flag has been passed to Hilbish.
|
flag(f) > Checks if the `f` flag has been passed to Hilbish.
|
||||||
|
|
||||||
|
read(prompt) -> input? > Read input from the user, using Hilbish's line editor/input reader.
|
||||||
|
This is a separate instance from the one Hilbish actually uses.
|
||||||
|
Returns `input`, will be nil if ctrl + d is pressed, or an error occurs (which shouldn't happen)
|
||||||
|
|
||||||
run(cmd) > Runs `cmd` in Hilbish's sh interpreter
|
run(cmd) > Runs `cmd` in Hilbish's sh interpreter
|
||||||
|
|
||||||
|
|
22
hilbish.go
22
hilbish.go
|
@ -19,6 +19,7 @@ var exports = map[string]lua.LGFunction {
|
||||||
"run": hlrun,
|
"run": hlrun,
|
||||||
"flag": hlflag,
|
"flag": hlflag,
|
||||||
"cwd": hlcwd,
|
"cwd": hlcwd,
|
||||||
|
"read": hlread,
|
||||||
}
|
}
|
||||||
|
|
||||||
func HilbishLoader(L *lua.LState) int {
|
func HilbishLoader(L *lua.LState) int {
|
||||||
|
@ -36,6 +37,8 @@ func HilbishLoader(L *lua.LState) int {
|
||||||
L.SetField(mod, "host", lua.LString(host))
|
L.SetField(mod, "host", lua.LString(host))
|
||||||
L.SetField(mod, "home", lua.LString(homedir))
|
L.SetField(mod, "home", lua.LString(homedir))
|
||||||
L.SetField(mod, "dataDir", lua.LString(dataDir))
|
L.SetField(mod, "dataDir", lua.LString(dataDir))
|
||||||
|
L.SetField(mod, "interactive", lua.LBool(interactive))
|
||||||
|
L.SetField(mod, "login", lua.LBool(interactive))
|
||||||
|
|
||||||
xdg := L.NewTable()
|
xdg := L.NewTable()
|
||||||
L.SetField(xdg, "config", lua.LString(confDir))
|
L.SetField(xdg, "config", lua.LString(confDir))
|
||||||
|
@ -92,3 +95,22 @@ func getenv(key, fallback string) string {
|
||||||
}
|
}
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// read(prompt) -> input?
|
||||||
|
// Read input from the user, using Hilbish's line editor/input reader.
|
||||||
|
// This is a separate instance from the one Hilbish actually uses.
|
||||||
|
// Returns `input`, will be nil if ctrl + d is pressed, or an error occurs (which shouldn't happen)
|
||||||
|
func hlread(L *lua.LState) int {
|
||||||
|
luaprompt := L.CheckString(1)
|
||||||
|
lualr := NewLineReader(luaprompt)
|
||||||
|
|
||||||
|
input, err := lualr.Read()
|
||||||
|
if err != nil {
|
||||||
|
L.Push(lua.LNil)
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
L.Push(lua.LString(input))
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue