mirror of https://github.com/Hilbis/Hilbish
Compare commits
2 Commits
88d9f2e21d
...
75d7c6acc6
Author | SHA1 | Date |
---|---|---|
sammy | 75d7c6acc6 | |
sammy | 96600398b7 |
13
main.go
13
main.go
|
@ -16,7 +16,7 @@ import (
|
|||
"golang.org/x/term"
|
||||
)
|
||||
|
||||
const version = "0.4.0-dev.5"
|
||||
const version = "0.4.0-dev.6"
|
||||
|
||||
var (
|
||||
l *lua.LState
|
||||
|
@ -49,13 +49,16 @@ func main() {
|
|||
_ = getopt.BoolLong("interactive", 'i', "Force Hilbish to be an interactive shell")
|
||||
|
||||
getopt.Parse()
|
||||
args := getopt.Args()
|
||||
interactiveflag := getopt.Lookup('i').Seen()
|
||||
|
||||
if *cmdflag == "" || interactiveflag {
|
||||
interactive = true
|
||||
}
|
||||
|
||||
if getopt.NArgs() > 0 {
|
||||
interactive = false
|
||||
}
|
||||
|
||||
if *verflag {
|
||||
fmt.Printf("Hilbish v%s\n", version)
|
||||
os.Exit(0)
|
||||
|
@ -97,11 +100,13 @@ func main() {
|
|||
readline.LoadHistory(homedir + "/.hilbish-history")
|
||||
|
||||
RunInput(*cmdflag)
|
||||
if len(args) > 0 {
|
||||
err := l.DoFile(args[0])
|
||||
if getopt.NArgs() > 0 {
|
||||
err := l.DoFile(getopt.Arg(0))
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
for interactive {
|
||||
|
|
Loading…
Reference in New Issue