mirror of
https://github.com/Hilbis/Hilbish
synced 2025-04-02 19:53:23 +00:00
fix: dont be interactvive if source is provided
hilbish wont go into an interactive mode if its provided a lua source file to run, even if -i is passed. i feel like this makes the most sense.
This commit is contained in:
parent
88d9f2e21d
commit
96600398b7
11
main.go
11
main.go
@ -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…
x
Reference in New Issue
Block a user