mirror of https://github.com/Hilbis/Hilbish
Compare commits
3 Commits
a3abd4bc91
...
52379dbdd7
Author | SHA1 | Date |
---|---|---|
TorchedSammy | 52379dbdd7 | |
TorchedSammy | 36cd4d4123 | |
TorchedSammy | d355d02b93 |
|
@ -10,7 +10,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
goos: [linux, windows]
|
||||
goos: [linux, windows, darwin]
|
||||
goarch: ["386", amd64, arm64]
|
||||
exclude:
|
||||
- goarch: "386"
|
||||
|
|
33
main.go
33
main.go
|
@ -5,17 +5,16 @@ 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"
|
||||
)
|
||||
|
||||
|
@ -176,8 +175,12 @@ input:
|
|||
break
|
||||
}
|
||||
if err != nil {
|
||||
// If we get a completely random error, print
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
if err != readline.CtrlC {
|
||||
// If we get a completely random error, print
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
}
|
||||
fmt.Println("^C")
|
||||
continue
|
||||
}
|
||||
oldInput := input
|
||||
|
||||
|
@ -254,28 +257,6 @@ 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)
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
// +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")
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
// +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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
// +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