From 89dc3c2078baeefd494f529cc4b11c40b40f6fbc Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 19 Dec 2008 23:59:25 +1100 Subject: [PATCH] trivial refactoring of :emenu and :chdir actions --- common/content/io.js | 20 ++++++++++---------- common/content/liberator.js | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/common/content/io.js b/common/content/io.js index 8a5e3d97..136b2b13 100644 --- a/common/content/io.js +++ b/common/content/io.js @@ -194,17 +194,17 @@ function IO() //{{{ "Change the current directory", function (args) { - args = args.literalArg; + let arg = args.literalArg; - if (!args) + if (!arg) { - args = "~"; + arg = "~"; } - else if (args == "-") + else if (arg == "-") { if (oldcwd) { - args = oldcwd.path; + arg = oldcwd.path; } else { @@ -213,14 +213,14 @@ function IO() //{{{ } } - args = io.expandPath(args); + arg = io.expandPath(arg); // go directly to an absolute path or look for a relative path // match in 'cdpath' // TODO: handle ../ and ./ paths - if (isAbsolutePath(args)) + if (isAbsolutePath(arg)) { - if (io.setCurrentDirectory(args)) + if (io.setCurrentDirectory(arg)) liberator.echomsg(io.getCurrentDirectory().path); } else @@ -230,7 +230,7 @@ function IO() //{{{ for (let [,dir] in Iterator(dirs)) { - dir = joinPaths(dir, args); + dir = joinPaths(dir, arg); if (dir.exists() && dir.isDirectory() && dir.isReadable()) { @@ -243,7 +243,7 @@ function IO() //{{{ if (!found) { - liberator.echoerr("E344: Can't find directory " + args.quote() + " in cdpath\n" + liberator.echoerr("E344: Can't find directory " + arg.quote() + " in cdpath\n" + "E472: Command failed"); } } diff --git a/common/content/liberator.js b/common/content/liberator.js index 2edaa653..e5c8cfa8 100644 --- a/common/content/liberator.js +++ b/common/content/liberator.js @@ -289,18 +289,18 @@ const liberator = (function () //{{{ "Execute the specified menu item from the command line", function (args) { - args = args.literalArg; + let arg = args.literalArg; let items = getMenuItems(); - if (!items.some(function (i) i.fullMenuPath == args)) + if (!items.some(function (i) i.fullMenuPath == arg)) { - liberator.echoerr("E334: Menu not found: " + args); + liberator.echoerr("E334: Menu not found: " + arg); return; } for (let [,item] in Iterator(items)) { - if (item.fullMenuPath == args) + if (item.fullMenuPath == arg) item.doCommand(); } },