cd if first argument is a directory

Related #167
This commit is contained in:
Gokcehan 2019-05-18 17:51:32 +03:00
parent f071a3ae70
commit 80ab2e4fc4

9
app.go
View File

@ -137,7 +137,14 @@ func (app *app) loop() {
if gSelect != "" {
go func() {
app.ui.exprChan <- &callExpr{"select", []string{gSelect}, 1}
stat, err := os.Stat(gSelect)
if err != nil {
app.ui.exprChan <- &callExpr{"echoerr", []string{err.Error()}, 1}
} else if stat.IsDir() {
app.ui.exprChan <- &callExpr{"cd", []string{gSelect}, 1}
} else {
app.ui.exprChan <- &callExpr{"select", []string{gSelect}, 1}
}
}()
}