diff --git a/content/bookmarks.js b/content/bookmarks.js index 3743a46e..faf3a045 100644 --- a/content/bookmarks.js +++ b/content/bookmarks.js @@ -154,8 +154,7 @@ liberator.Bookmarks = function () //{{{ liberator.commandline.echo(list, liberator.commandline.HL_NORMAL, liberator.commandline.FORCE_MULTILINE); }, - {} - ); + { argCount: "0" }); liberator.commands.add(["bma[rk]"], "Add a bookmark", diff --git a/content/buffer.js b/content/buffer.js index 14e62863..4978b5e5 100644 --- a/content/buffer.js +++ b/content/buffer.js @@ -460,7 +460,11 @@ liberator.Buffer = function () //{{{ liberator.commands.add(["pa[geinfo]"], "Show various page information", - function () { liberator.buffer.showPageInfo(true); }); + function () + { + liberator.buffer.showPageInfo(true); + }, + { argCount: "0" }); liberator.commands.add(["pagest[yle]"], "Select the author style sheet to apply", @@ -485,7 +489,11 @@ liberator.Buffer = function () //{{{ liberator.commands.add(["re[load]"], "Reload current page", - function (args, special) { liberator.tabs.reload(getBrowser().mCurrentTab, special); }); + function (args, special) + { + liberator.tabs.reload(getBrowser().mCurrentTab, special); + }, + { argCount: "0" }); liberator.commands.add(["sav[eas]", "w[rite]"], "Save current document to disk", @@ -505,7 +513,11 @@ liberator.Buffer = function () //{{{ liberator.commands.add(["st[op]"], "Stop loading", - function () { BrowserStop(); }); + function () + { + BrowserStop(); + }, + { argCount: "0" }); liberator.commands.add(["vie[wsource]"], "View source code of current document", diff --git a/content/commands.js b/content/commands.js index 7f4a7ee6..fb2f05e4 100644 --- a/content/commands.js +++ b/content/commands.js @@ -281,8 +281,8 @@ liberator.Commands = function () //{{{ // @param argCount can be: // "0": no arguments // "1": exactly one argument - // "+": one or more aguments - // "*": zero or more arguments + // "+": one or more arguments + // "*": zero or more arguments (default if unspecified) // "?": zero or one arguments // @param allowUnknownOptions: -foo won't result in an error, if -foo isn't // specified in "options" @@ -688,7 +688,7 @@ liberator.Commands = function () //{{{ commandManager.add(["comc[lear]"], "Delete all user-defined commands", - function (args) + function () { var commands = getUserCommands(); for (var i = 0; i < commands.length; i++) diff --git a/content/editor.js b/content/editor.js index 49b5197d..e4f76d2f 100644 --- a/content/editor.js +++ b/content/editor.js @@ -178,7 +178,11 @@ liberator.Editor = function () //{{{ liberator.commands.add([ch + "abc[lear]"], "Remove all abbreviations" + modeDescription, - function (args) { liberator.editor.removeAllAbbreviations(mode); }); + function () + { + liberator.editor.removeAllAbbreviations(mode); + }, + { argCount: "0" }); } /////////////////////////////////////////////////////////////////////////////}}} diff --git a/content/find.js b/content/find.js index 8cef1d13..812c06d8 100644 --- a/content/find.js +++ b/content/find.js @@ -191,7 +191,11 @@ liberator.Search = function () //{{{ liberator.commands.add(["noh[lsearch]"], "Remove the search highlighting", - function (args) { liberator.search.clear(); }); + function () + { + liberator.search.clear(); + }, + { argCount: "0" }); /////////////////////////////////////////////////////////////////////////////}}} ////////////////////// PUBLIC SECTION ////////////////////////////////////////// diff --git a/content/io.js b/content/io.js index 8c6c7bd7..0c04f999 100644 --- a/content/io.js +++ b/content/io.js @@ -89,7 +89,7 @@ liberator.IO = function () //{{{ liberator.commands.add(["pw[d]"], "Print the current directory name", - function (args) + function () { liberator.echo(liberator.io.getCurrentDirectory()); }, diff --git a/content/liberator.js b/content/liberator.js index 46ba3f23..c2f0625f 100644 --- a/content/liberator.js +++ b/content/liberator.js @@ -120,11 +120,16 @@ const liberator = (function () //{{{ (liberator.options["newtab"] && (liberator.options["newtab"] == "all" || liberator.options["newtab"].split(",").indexOf("addons") != -1)) ? liberator.NEW_TAB: liberator.CURRENT_TAB); - }); + }, + { argCount: "0" }); liberator.commands.add(["beep"], "Play a system beep", - function () { liberator.beep(); }); + function () + { + liberator.beep(); + }, + { argCount: "0" }); liberator.commands.add(["dia[log]"], "Open a " + liberator.config.appName + " dialog", @@ -230,7 +235,8 @@ const liberator = (function () //{{{ usage += ""; liberator.echo(usage, liberator.commandline.FORCE_MULTILINE); - }); + }, + { argCount: "0" }); liberator.commands.add(["h[elp]"], "Display help", @@ -302,11 +308,16 @@ const liberator = (function () //{{{ liberator.tabs.remove(getBrowser().mCurrentTab, 1, false, 1); else liberator.quit(false); - }); + }, + { argCount: "0" }); liberator.commands.add(["res[tart]"], "Force " + liberator.config.appName + " to restart", - function () { liberator.restart(); }); + function () + { + liberator.restart(); + }, + { argCount: "0" }); liberator.commands.add(["time"], "Profile a piece of code or run a command multiple times", @@ -411,7 +422,8 @@ const liberator = (function () //{{{ liberator.echo(":" + liberator.util.escapeHTML(liberator.commandline.getCommand()) + "\n" + liberator.config.name + " " + liberator.version + " running on:\n" + navigator.userAgent); - }); + }, + { argCount: "0" }); liberator.commands.add(["viu[sage]"], "List all mappings with a short description", @@ -427,7 +439,8 @@ const liberator = (function () //{{{ usage += ""; liberator.echo(usage, liberator.commandline.FORCE_MULTILINE); - }); + }, + { argCount: "0" }); } function getHelpCompletions(filter) diff --git a/content/mail.js b/content/mail.js index 4a20689e..c28aa511 100644 --- a/content/mail.js +++ b/content/mail.js @@ -725,7 +725,7 @@ liberator.Mail = function () //{{{ liberator.commands.add(["empty[trash]"], "Empty trash of the current account", - function (args, special) + function () { goDoCommand("cmd_emptyTrash"); }, diff --git a/content/mappings.js b/content/mappings.js index ebdb2724..f31f5938 100644 --- a/content/mappings.js +++ b/content/mappings.js @@ -211,7 +211,7 @@ liberator.Mappings = function () //{{{ liberator.commands.add([ch + "mapc[lear]"], "Remove all mappings" + modeDescription, - function (args) + function () { for (let i = 0; i < modes.length; i++) liberator.mappings.removeAll(modes[i]); diff --git a/content/options.js b/content/options.js index 9ed62c32..82b39a0a 100644 --- a/content/options.js +++ b/content/options.js @@ -321,7 +321,7 @@ liberator.Options = function () //{{{ liberator.commands.add(["pref[erences]", "prefs"], "Show " + liberator.config.hostApplication + " preferences", - function (args, special, count, modifiers) + function (args, special) { if (special) // open Firefox settings GUI dialog { diff --git a/content/tabs.js b/content/tabs.js index 53810fdf..6fafe267 100644 --- a/content/tabs.js +++ b/content/tabs.js @@ -303,7 +303,11 @@ liberator.Tabs = function () //{{{ liberator.commands.add(["tabl[ast]", "bl[ast]"], "Switch to the last tab", - function () { liberator.tabs.select("$", false); }); + function () + { + liberator.tabs.select("$", false); + }, + { argCount: "0" }); // TODO: "Zero count" if 0 specified as arg liberator.commands.add(["tabp[revious]", "tp[revious]", "tabN[ext]", "tN[ext]", "bp[revious]", "bN[ext]"], @@ -368,7 +372,11 @@ liberator.Tabs = function () //{{{ liberator.commands.add(["tabr[ewind]", "tabfir[st]", "br[ewind]", "bf[irst]"], "Switch to the first tab", - function () { liberator.tabs.select(0, false); }); + function () + { + liberator.tabs.select(0, false); + }, + { argCount: "0" }); if (liberator.config.name == "Vimperator") @@ -408,11 +416,19 @@ liberator.Tabs = function () //{{{ liberator.commands.add(["quita[ll]", "qa[ll]"], "Quit " + liberator.config.appName, - function () { liberator.quit(false); }); + function () + { + liberator.quit(false); + }, + { argCount: "0" }); liberator.commands.add(["reloada[ll]"], "Reload all tab pages", - function (args, special) { liberator.tabs.reloadAll(special); }); + function (args, special) + { + liberator.tabs.reloadAll(special); + }, + { argCount: "0" }); // TODO: add count support liberator.commands.add(["tabm[ove]"], @@ -434,7 +450,11 @@ liberator.Tabs = function () //{{{ liberator.commands.add(["tabo[nly]"], "Close all other tabs", - function () { liberator.tabs.keepOnly(getBrowser().mCurrentTab); }); + function () + { + liberator.tabs.keepOnly(getBrowser().mCurrentTab); + }, + { argCount: "0" }); liberator.commands.add(["tabopen", "t[open]", "tabnew", "tabe[dit]"], "Open one or more URLs in a new tab", @@ -466,7 +486,8 @@ liberator.Tabs = function () //{{{ for (var i = 0; i < count; i++) liberator.tabs.cloneTab(tab, activate); - }); + }, + { argCount: "0" }); } if (liberator.has("session")) @@ -535,11 +556,16 @@ liberator.Tabs = function () //{{{ var undoItems = eval("(" + ss.getClosedTabData(window) + ")"); for (var i = 0; i < undoItems.length; i++) undoCloseTab(); // doesn't work with i as the index to undoCloseTab - }); + }, + { argCount: "0" }); liberator.commands.add(["wqa[ll]", "wq", "xa[ll]"], "Save the session and quit", - function () { liberator.quit(true); }); + function () + { + liberator.quit(true); + }, + { argCount: "0" }); } /////////////////////////////////////////////////////////////////////////////}}} diff --git a/content/vimperator.js b/content/vimperator.js index 97a4b404..755e123b 100644 --- a/content/vimperator.js +++ b/content/vimperator.js @@ -256,7 +256,8 @@ liberator.config = { //{{{ liberator.open("chrome://mozapps/content/downloads/downloads.xul", (liberator.options["newtab"] == "all" || liberator.options["newtab"].split(",").indexOf("downloads") != -1) ? liberator.NEW_TAB : liberator.CURRENT_TAB); - }); + }, + { argCount: "0" }); liberator.commands.add(["o[pen]", "e[dit]"], "Open one or more URLs in the current tab", @@ -285,12 +286,13 @@ liberator.config = { //{{{ var wu = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor). getInterface(Components.interfaces.nsIDOMWindowUtils); wu.redraw(); - }); + }, + { argCount: "0" }); // TODO: move sidebar commands to ui.js? liberator.commands.add(["sbcl[ose]"], "Close the sidebar window", - function (args) + function () { if (document.getElementById("sidebar-box").hidden == false) toggleSidebar(); @@ -335,7 +337,11 @@ liberator.config = { //{{{ liberator.commands.add(["winc[lose]", "wc[lose]"], "Close window", - function (args) { window.close(); }); + function () + { + window.close(); + }, + { argCount: "0" }); liberator.commands.add(["wino[pen]", "wo[pen]", "wine[dit]"], "Open one or more URLs in a new window",