fix cd command without any argument

This commit is contained in:
CodinCat 2016-08-19 10:53:25 +08:00 committed by GitHub
parent 4b0a6d1013
commit aae350fea5

View File

@ -195,7 +195,11 @@ func (e *CallExpr) eval(app *App, args []string) {
app.nav.top() app.nav.top()
app.ui.echoFileInfo(app.nav) app.ui.echoFileInfo(app.nav)
case "cd": case "cd":
if err := app.nav.cd(e.args[0]); err != nil { path := "~"
if len(e.args) > 0 {
path = e.args[0]
}
if err := app.nav.cd(path); err != nil {
app.ui.message = err.Error() app.ui.message = err.Error()
log.Print(err) log.Print(err)
return return