mirror of https://github.com/Hilbis/Hilbish
Compare commits
18 Commits
14e6ae5a3c
...
7aa9fb9fe6
Author | SHA1 | Date |
---|---|---|
sammyette | 7aa9fb9fe6 | |
sammyette | 459606618c | |
sammyette | 1f3162fc4f | |
sammyette | 439930a653 | |
sammyette | 9e5dbfc7e0 | |
sammyette | 571764a87f | |
sammyette | c277c67786 | |
sammyette | 35c0a0d386 | |
sammyette | aadb5f373c | |
sammyette | 88f750f546 | |
sammyette | bbec5c3c14 | |
sammyette | 92f9e51a15 | |
sammyette | d3989e09ed | |
sammyette | b9864ce4c6 | |
sammyette | fd32275f70 | |
sammyette | 08a3e75fd1 | |
sammyette | d4a595d2a8 | |
sammyette | 9f1ad83c51 |
|
@ -0,0 +1,31 @@
|
||||||
|
name: Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
- push
|
||||||
|
- pull_request
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: ${{ matrix.build }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- build: linux-amd64
|
||||||
|
os: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: '1.16.2'
|
||||||
|
- name: Build
|
||||||
|
run: make hilbiline
|
||||||
|
- uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: hilbish-${{ matrix.build }}
|
||||||
|
path: hilbish
|
||||||
|
|
42
README.md
42
README.md
|
@ -25,16 +25,27 @@ but there may still be breaking changes in Lua modules.
|
||||||
- **[Gallery](https://github.com/Hilbis/Hilbish/discussions/36)** - See
|
- **[Gallery](https://github.com/Hilbis/Hilbish/discussions/36)** - See
|
||||||
more screenshots of Hilbish in action
|
more screenshots of Hilbish in action
|
||||||
|
|
||||||
# Building
|
# Installation
|
||||||
Prebuilt binaries are not yet provided, so to try it out you'll have to manually compile.
|
|
||||||
|
|
||||||
**NOTE:** Hilbish is currently only officially supported and tested on Linux
|
**NOTE:** Hilbish is currently only officially supported and tested on Linux
|
||||||
|
|
||||||
### Prerequisites
|
### Prebuilt binaries
|
||||||
|
Binaries are provided for the latest commit.
|
||||||
|
|
||||||
|
**Note that these use Hilbiline, not readline, and may be missing functionality
|
||||||
|
(moving the cursor, proper unicode support and backspace working properly)**
|
||||||
|
|
||||||
|
Click on the checkmark (or x) near the commit hash, then details for your platform
|
||||||
|
<br><img src="https://modeus.is-inside.me/dyr8UGGq.png"><br>
|
||||||
|
|
||||||
|
Then click on the artifacts drop down, and download artifact for your platform,
|
||||||
|
like what is highlighted in the screenshot.
|
||||||
|
<br><img src="https://modeus.is-inside.me/KJ0Puceb.png"><br>
|
||||||
|
|
||||||
|
### Manual Build
|
||||||
|
#### Prerequisites
|
||||||
- [Go 1.16](https://go.dev)
|
- [Go 1.16](https://go.dev)
|
||||||
|
|
||||||
- GNU Readline
|
- GNU Readline
|
||||||
|
|
||||||
On Fedora, readline can be installed with:
|
On Fedora, readline can be installed with:
|
||||||
```
|
```
|
||||||
sudo dnf install readline-devel
|
sudo dnf install readline-devel
|
||||||
|
@ -50,27 +61,26 @@ On OpenSUSE, it can be installed with:
|
||||||
sudo zypper install readline-devel
|
sudo zypper install readline-devel
|
||||||
```
|
```
|
||||||
|
|
||||||
### Install
|
#### Build
|
||||||
First, clone Hilbish:
|
First, clone Hilbish:
|
||||||
```sh
|
```sh
|
||||||
git clone --recursive https://github.com/Hilbis/Hilbish
|
git clone --recursive https://github.com/Hilbis/Hilbish
|
||||||
cd Hilbish
|
cd Hilbish
|
||||||
|
# If you want the latest stable release, run this following command
|
||||||
|
git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
|
||||||
```
|
```
|
||||||
|
|
||||||
Then build and install:
|
And get dependencies and build:
|
||||||
```sh
|
```sh
|
||||||
|
go get -d
|
||||||
make dev
|
make dev
|
||||||
sudo make install
|
# If you want to use latest stable release,
|
||||||
# Or
|
|
||||||
sudo make all
|
|
||||||
```
|
|
||||||
|
|
||||||
Or, if you want the latest stable release:
|
|
||||||
```
|
|
||||||
git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
|
|
||||||
make build
|
make build
|
||||||
sudo make install
|
# or want to use Hilbiline,
|
||||||
|
make hilbiline
|
||||||
```
|
```
|
||||||
|
#### Install
|
||||||
|
`sudo make install`
|
||||||
|
|
||||||
Alternatively, if you use Arch Linux, you can compile Hilbish with an **(unofficial)** AUR package:
|
Alternatively, if you use Arch Linux, you can compile Hilbish with an **(unofficial)** AUR package:
|
||||||
```sh
|
```sh
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package fs
|
package fs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
@ -31,9 +32,13 @@ func cd(L *lua.LState) int {
|
||||||
|
|
||||||
err := os.Chdir(strings.TrimSpace(path))
|
err := os.Chdir(strings.TrimSpace(path))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
switch err.(*os.PathError).Err.Error() {
|
switch e := err.(*os.PathError).Err.Error(); e {
|
||||||
case "no such file or directory":
|
case "no such file or directory":
|
||||||
LuaErr(L, 1)
|
LuaErr(L, 1)
|
||||||
|
default:
|
||||||
|
fmt.Printf("Found unhandled error case: %s", e)
|
||||||
|
fmt.Printf("Report this at https://github.com/Hilbis/Hilbish/issues with the title being: \"fs: unahndled error case %s\", and show what caused it.\n", e)
|
||||||
|
LuaErr(L, 213)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
32
shell.go
32
shell.go
|
@ -16,7 +16,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func RunInput(input string) {
|
func RunInput(input string) {
|
||||||
_, cmdString := splitInput(input)
|
cmdArgs, cmdString := splitInput(input)
|
||||||
|
|
||||||
// First try to load input, essentially compiling to bytecode
|
// First try to load input, essentially compiling to bytecode
|
||||||
fn, err := l.LoadString(cmdString)
|
fn, err := l.LoadString(cmdString)
|
||||||
|
@ -38,6 +38,31 @@ func RunInput(input string) {
|
||||||
hooks.Em.Emit("command.exit", 0)
|
hooks.Em.Emit("command.exit", 0)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if commands[cmdArgs[0]] {
|
||||||
|
err := l.CallByParam(lua.P{
|
||||||
|
Fn: l.GetField(
|
||||||
|
l.GetTable(
|
||||||
|
l.GetGlobal("commanding"),
|
||||||
|
lua.LString("__commands")),
|
||||||
|
cmdArgs[0]),
|
||||||
|
NRet: 1,
|
||||||
|
Protect: true,
|
||||||
|
}, luar.New(l, cmdArgs[1:]))
|
||||||
|
luaexitcode := l.Get(-1)
|
||||||
|
var exitcode uint8 = 0
|
||||||
|
|
||||||
|
l.Pop(1)
|
||||||
|
|
||||||
|
if code, ok := luaexitcode.(lua.LNumber); luaexitcode != lua.LNil && ok {
|
||||||
|
exitcode = uint8(code)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintln(os.Stderr,
|
||||||
|
"Error in command:\n\n" + err.Error())
|
||||||
|
}
|
||||||
|
hooks.Em.Emit("command.exit", exitcode)
|
||||||
|
}
|
||||||
|
|
||||||
// Last option: use sh interpreter
|
// Last option: use sh interpreter
|
||||||
err = execCommand(cmdString)
|
err = execCommand(cmdString)
|
||||||
|
@ -122,6 +147,11 @@ func execCommand(cmd string) error {
|
||||||
return interp.NewExitStatus(exitcode)
|
return interp.NewExitStatus(exitcode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err := l.DoString(argstring)
|
||||||
|
if err == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
if _, err := interp.LookPathDir(hc.Dir, hc.Env, args[0]); err != nil {
|
if _, err := interp.LookPathDir(hc.Dir, hc.Env, args[0]); err != nil {
|
||||||
hooks.Em.Emit("command.not-found", args[0])
|
hooks.Em.Emit("command.not-found", args[0])
|
||||||
return interp.NewExitStatus(127)
|
return interp.NewExitStatus(127)
|
||||||
|
|
Loading…
Reference in New Issue