Compare commits

..

No commits in common. "75d7c6acc668109e5cd17fcc6818a7a37c1d63de" and "88d9f2e21df0145bc026ddf2567ac4dce89e2340" have entirely different histories.

1 changed files with 4 additions and 9 deletions

13
main.go
View File

@ -16,7 +16,7 @@ import (
"golang.org/x/term" "golang.org/x/term"
) )
const version = "0.4.0-dev.6" const version = "0.4.0-dev.5"
var ( var (
l *lua.LState l *lua.LState
@ -49,16 +49,13 @@ func main() {
_ = getopt.BoolLong("interactive", 'i', "Force Hilbish to be an interactive shell") _ = getopt.BoolLong("interactive", 'i', "Force Hilbish to be an interactive shell")
getopt.Parse() getopt.Parse()
args := getopt.Args()
interactiveflag := getopt.Lookup('i').Seen() interactiveflag := getopt.Lookup('i').Seen()
if *cmdflag == "" || interactiveflag { if *cmdflag == "" || interactiveflag {
interactive = true interactive = true
} }
if getopt.NArgs() > 0 {
interactive = false
}
if *verflag { if *verflag {
fmt.Printf("Hilbish v%s\n", version) fmt.Printf("Hilbish v%s\n", version)
os.Exit(0) os.Exit(0)
@ -100,13 +97,11 @@ func main() {
readline.LoadHistory(homedir + "/.hilbish-history") readline.LoadHistory(homedir + "/.hilbish-history")
RunInput(*cmdflag) RunInput(*cmdflag)
if getopt.NArgs() > 0 { if len(args) > 0 {
err := l.DoFile(getopt.Arg(0)) err := l.DoFile(args[0])
if err != nil { if err != nil {
fmt.Fprintln(os.Stderr, err) fmt.Fprintln(os.Stderr, err)
os.Exit(1)
} }
os.Exit(0)
} }
for interactive { for interactive {