From a6ae19b0b3e2e2b13204ff7c8157ebd4ae2057a3 Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Sun, 28 Aug 2016 17:02:58 +0300 Subject: [PATCH] cleanup --- eval.go | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/eval.go b/eval.go index 6f98dca..33c5cbe 100644 --- a/eval.go +++ b/eval.go @@ -116,16 +116,12 @@ func (e *CmdExpr) eval(app *App, args []string) { func (e *CallExpr) eval(app *App, args []string) { // TODO: check for extra toks in each case switch e.name { - case "quit": - gExitFlag = true - case "echo": - app.ui.message = strings.Join(e.args, " ") - case "down": - app.nav.down() - app.ui.echoFileInfo(app.nav) case "up": app.nav.up() app.ui.echoFileInfo(app.nav) + case "down": + app.nav.down() + app.ui.echoFileInfo(app.nav) case "updir": if err := app.nav.updir(); err != nil { app.ui.message = err.Error() @@ -184,23 +180,14 @@ func (e *CallExpr) eval(app *App, args []string) { if cmd, ok := gOpts.cmds["open-file"]; ok { cmd.eval(app, e.args) } + case "quit": + gExitFlag = true case "bot": app.nav.bot() app.ui.echoFileInfo(app.nav) case "top": app.nav.top() app.ui.echoFileInfo(app.nav) - case "cd": - path := "~" - if len(e.args) > 0 { - path = e.args[0] - } - if err := app.nav.cd(path); err != nil { - app.ui.message = err.Error() - log.Print(err) - return - } - app.ui.echoFileInfo(app.nav) case "read": s := app.ui.prompt(app.nav, ":") if len(s) == 0 { @@ -270,6 +257,19 @@ func (e *CallExpr) eval(app *App, args []string) { app.ui.sync() app.ui.renew() app.nav.renew(app.ui.wins[0].h) + case "echo": + app.ui.message = strings.Join(e.args, " ") + case "cd": + path := "~" + if len(e.args) > 0 { + path = e.args[0] + } + if err := app.nav.cd(path); err != nil { + app.ui.message = err.Error() + log.Print(err) + return + } + app.ui.echoFileInfo(app.nav) default: cmd, ok := gOpts.cmds[e.name] if !ok {