mirror of
				https://github.com/sammy-ette/Hilbish
				synced 2025-08-10 02:52:03 +00:00 
			
		
		
		
	Compare commits
	
		
			3 Commits
		
	
	
		
			a3abd4bc91
			...
			52379dbdd7
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 52379dbdd7 | ||
|  | 36cd4d4123 | ||
|  | d355d02b93 | 
							
								
								
									
										2
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							| @ -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" | ||||
|  | ||||
							
								
								
									
										29
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								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,9 +175,13 @@ 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) | ||||
| @ -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) | ||||
|  | ||||
							
								
								
									
										31
									
								
								signal_unix.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								signal_unix.go
									
									
									
									
									
										Normal file
									
								
							| @ -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") | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										23
									
								
								signal_windows.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								signal_windows.go
									
									
									
									
									
										Normal file
									
								
							| @ -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() | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										20
									
								
								vars_darwin.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								vars_darwin.go
									
									
									
									
									
										Normal file
									
								
							| @ -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…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user