mirror of https://github.com/Hilbis/Hilbish
Compare commits
No commits in common. "52379dbdd728419e115b556d7fda2500a8a2922d" and "a3abd4bc9135c4722a40bb075cc88cc9e31ddee1" have entirely different histories.
52379dbdd7
...
a3abd4bc91
|
@ -10,7 +10,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
goos: [linux, windows, darwin]
|
||||
goos: [linux, windows]
|
||||
goarch: ["386", amd64, arm64]
|
||||
exclude:
|
||||
- goarch: "386"
|
||||
|
|
29
main.go
29
main.go
|
@ -5,16 +5,17 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/signal"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
"hilbish/golibs/bait"
|
||||
|
||||
"github.com/pborman/getopt"
|
||||
"github.com/yuin/gopher-lua"
|
||||
"github.com/maxlandon/readline"
|
||||
"golang.org/x/term"
|
||||
)
|
||||
|
||||
|
@ -175,13 +176,9 @@ input:
|
|||
break
|
||||
}
|
||||
if err != nil {
|
||||
if err != readline.CtrlC {
|
||||
// If we get a completely random error, print
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
}
|
||||
fmt.Println("^C")
|
||||
continue
|
||||
}
|
||||
oldInput := input
|
||||
|
||||
input = strings.TrimSpace(input)
|
||||
|
@ -257,6 +254,28 @@ func fmtPrompt() string {
|
|||
return nprompt
|
||||
}
|
||||
|
||||
func handleSignals() {
|
||||
c := make(chan os.Signal)
|
||||
signal.Notify(c, os.Interrupt, syscall.SIGWINCH, syscall.SIGUSR1, syscall.SIGUSR2)
|
||||
|
||||
for s := range c {
|
||||
switch s {
|
||||
case os.Interrupt:
|
||||
hooks.Em.Emit("signal.sigint")
|
||||
if !running && interactive {
|
||||
lr.ClearInput()
|
||||
}
|
||||
case syscall.SIGWINCH:
|
||||
hooks.Em.Emit("signal.resize")
|
||||
if !running && interactive {
|
||||
lr.Resize()
|
||||
}
|
||||
case syscall.SIGUSR1: hooks.Em.Emit("signal.sigusr1")
|
||||
case syscall.SIGUSR2: hooks.Em.Emit("signal.sigusr2")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func handleHistory(cmd string) {
|
||||
lr.AddHistory(cmd)
|
||||
// TODO: load history again (history shared between sessions like this ye)
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
// +build darwin linux
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"os"
|
||||
"os/signal"
|
||||
)
|
||||
|
||||
func handleSignals() {
|
||||
c := make(chan os.Signal)
|
||||
signal.Notify(c, os.Interrupt, syscall.SIGWINCH, syscall.SIGUSR1, syscall.SIGUSR2)
|
||||
|
||||
for s := range c {
|
||||
switch s {
|
||||
case os.Interrupt:
|
||||
hooks.Em.Emit("signal.sigint")
|
||||
if !running && interactive {
|
||||
lr.ClearInput()
|
||||
}
|
||||
case syscall.SIGWINCH:
|
||||
hooks.Em.Emit("signal.resize")
|
||||
if !running && interactive {
|
||||
lr.Resize()
|
||||
}
|
||||
case syscall.SIGUSR1: hooks.Em.Emit("signal.sigusr1")
|
||||
case syscall.SIGUSR2: hooks.Em.Emit("signal.sigusr2")
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
// +build windows
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/signal"
|
||||
)
|
||||
|
||||
func handleSignals() {
|
||||
c := make(chan os.Signal)
|
||||
signal.Notify(c, os.Interrupt)
|
||||
|
||||
for s := range c {
|
||||
switch s {
|
||||
case os.Interrupt:
|
||||
hooks.Em.Emit("signal.sigint")
|
||||
if !running && interactive {
|
||||
lr.ClearInput()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
// +build darwin
|
||||
|
||||
package main
|
||||
|
||||
// String vars that are free to be changed at compile time
|
||||
var (
|
||||
requirePaths = commonRequirePaths + `.. ';'
|
||||
.. hilbish.dataDir .. '/libs/?/init.lua;'
|
||||
.. hilbish.dataDir .. '/libs/?/?.lua;'` + macosUserPaths
|
||||
macosUserPaths = `
|
||||
.. hilbish.userDir.data .. '/hilbish/libs/?/init.lua;'
|
||||
.. hilbish.userDir.data .. '/hilbish/libs/?/?.lua;'
|
||||
.. hilbish.userDir.data .. '/hilbish/libs/?.lua;'
|
||||
.. hilbish.userDir.config .. '/hilbish/?/init.lua;'
|
||||
.. hilbish.userDir.config .. '/hilbish/?/?.lua;'
|
||||
.. hilbish.userDir.config .. '/hilbish/?.lua'`
|
||||
dataDir = "/usr/local/share/hilbish"
|
||||
preloadPath = dataDir + "/preload.lua"
|
||||
sampleConfPath = dataDir + "/.hilbishrc.lua" // Path to default/sample config
|
||||
)
|
Loading…
Reference in New Issue