2
2
şunun yansıması https://github.com/Hilbis/Hilbish eşitlendi 2025-07-15 15:22:03 +00:00

İşlemeleri karşılaştır

..

11 İşleme

Yazar SHA1 Mesaj Tarih
TorchedSammy
7486d58465 fix: merge conflicts 2021-03-26 01:14:25 -04:00
TorchedSammy
aea035fe41 wip(feat): bait package for hooks 2021-03-26 01:12:55 -04:00
TorchedSammy
c5fa238156 wip: get prompt from format function 2021-03-26 01:06:14 -04:00
devins2518
e4218a135a
fix: only create rc file if it doesn't exist (#10) 2021-03-25 12:07:51 -04:00
devins2518
eeafd1e5cf
fix: add hilbish to /etc/shells (#9) 2021-03-25 12:04:42 -04:00
TorchedSammy
deb1bc8a5e chore: bump version 2021-03-24 20:22:25 -04:00
TorchedSammy
1c1ec87612 feat: add to history for lua 2021-03-24 20:21:55 -04:00
TorchedSammy
972c6e44b3 feat: go to next line if sh input is incomplete 2021-03-24 19:18:30 -04:00
TorchedSammy
d3bd47963d chore: bump version 2021-03-24 15:04:09 -04:00
TorchedSammy
bad357af48 chore: update todo 2021-03-24 15:03:58 -04:00
TorchedSammy
e4c3445f59 chore: update readme 2021-03-24 15:03:49 -04:00
4 değiştirilmiş dosya ile 77 ekleme ve 17 silme

Dosyayı Görüntüle

@ -9,12 +9,14 @@ install:
@install -v -d "$(BINDIR)/" && install -m 0755 -v hilbish "$(BINDIR)/hilbish"
@mkdir -p "$(LIBDIR)"
@cp libs preload.lua .hilbishrc.lua "$(LIBDIR)" -r
@echo /usr/bin/hilbish >> /etc/shells
@echo "Hilbish Installed"
uninstall:
@rm -vrf \
"$(BINDIR)/hilbish" \
"$(LIBDIR)"
@sed '/\/usr\/bin\/hilbish/d' /etc/shells
@echo "Hilbish Uninstalled"
clean:

Dosyayı Görüntüle

@ -4,9 +4,6 @@
It is currently in a mostly beta state but is very much usable
(I'm using it right now).
There are still some things missing like pipes but granted that will be
added soon. (or you can use dev branch)
# Links
- **[Documentation](https://github.com/Hilbis/Hilbish/wiki)**

22
golibs/bait/bait.go Normal dosya
Dosyayı Görüntüle

@ -0,0 +1,22 @@
package bait
import (
"github.com/chuckpreslar/emission"
"github.com/yuin/gopher-lua"
)
type Bait struct{}
func New() Bait {
return Bait{}
}
func (b *Bait) Loader(L *lua.LState) int {
var exports = map[string]lua.LGFunction{}
mod := L.SetFuncs(L.NewTable(), exports)
L.Push(mod)
return 1
}

53
main.go
Dosyayı Görüntüle

@ -1,7 +1,7 @@
package main
import (
_ "bufio"
"bufio"
"fmt"
"os"
_ "os/exec"
@ -63,12 +63,14 @@ func main() {
}
homedir, _ := os.UserHomeDir()
if _, err := os.Stat(homedir + "/.hilbishrc.lua"); os.IsNotExist(err) {
err = os.WriteFile(homedir + "/.hilbishrc.lua", input, 0644)
if err != nil {
fmt.Println("Error creating config file")
fmt.Println(err)
return
}
}
HandleSignals()
LuaInit()
@ -83,7 +85,7 @@ func main() {
//fmt.Printf(prompt)
cmdString, err := readline.String(prompt)
cmdString, err := readline.String(fmtPrompt())
if err == io.EOF {
fmt.Println("")
break
@ -94,7 +96,10 @@ func main() {
cmdString = strings.TrimSuffix(cmdString, "\n")
err = l.DoString(cmdString)
if err == nil { continue }
if err == nil {
readline.AddHistory(cmdString)
continue
}
cmdArgs := splitInput(cmdString)
if len(cmdArgs) == 0 { continue }
@ -129,10 +134,47 @@ func main() {
default:
err := execCommand(cmdString)
if err != nil {
if syntax.IsIncomplete(err) {
sb := &strings.Builder{}
for {
done := StartMultiline(cmdString, sb)
if done {
break
}
}
} else {
fmt.Fprintln(os.Stderr, err)
}
}
}
}
}
func fmtPrompt() string {
return prompt
}
func StartMultiline(prev string, sb *strings.Builder) bool {
if sb.String() == "" { sb.WriteString(prev + "\n") }
fmt.Printf("... ")
reader := bufio.NewReader(os.Stdin)
cont, err := reader.ReadString('\n')
if err == io.EOF {
fmt.Println("")
return true
}
sb.WriteString(cont)
err = execCommand(sb.String())
if err != nil && syntax.IsIncomplete(err) {
return false
}
return true
}
func splitInput(input string) []string {
@ -165,10 +207,7 @@ func splitInput(input string) []string {
func execCommand(cmd string) error {
file, err := syntax.NewParser().Parse(strings.NewReader(cmd), "")
if err != nil {
if syntax.IsIncomplete(err) {
fmt.Println("incomplete input")
return nil
}
return err
}
runner, _ := interp.New(
interp.StdIO(os.Stdin, os.Stdout, os.Stderr),