1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 13:22:28 +01:00

add some missing argCount specs to commands

This commit is contained in:
Doug Kearns
2008-10-06 13:07:57 +00:00
parent 6afe44a1f3
commit 413e01da41
8 changed files with 35 additions and 30 deletions

View File

@@ -287,11 +287,9 @@ liberator.Bookmarks = function () //{{{
"Delete a bookmark", "Delete a bookmark",
function (args) function (args)
{ {
var url = args; let url = args || liberator.buffer.URL;
if (!url) let deletedCount = liberator.bookmarks.remove(url);
url = liberator.buffer.URL;
var deletedCount = liberator.bookmarks.remove(url);
liberator.echo(deletedCount + " bookmark(s) with url `" + url + "' deleted", liberator.commandline.FORCE_SINGLELINE); liberator.echo(deletedCount + " bookmark(s) with url `" + url + "' deleted", liberator.commandline.FORCE_SINGLELINE);
}, },
{ completer: function (filter) [0, liberator.bookmarks.get(filter)] }); { completer: function (filter) [0, liberator.bookmarks.get(filter)] });

View File

@@ -675,7 +675,10 @@ liberator.Buffer = function () //{{{
liberator.options.setPref("print.show_print_progress", spp); liberator.options.setPref("print.show_print_progress", spp);
liberator.echo("Print job sent."); liberator.echo("Print job sent.");
}, },
{ bang: true }); {
argCount: "0",
bang: true
});
liberator.commands.add(["pa[geinfo]"], liberator.commands.add(["pa[geinfo]"],
"Show various page information", "Show various page information",
@@ -724,7 +727,10 @@ liberator.Buffer = function () //{{{
//else //else
saveDocument(window.content.document, special); saveDocument(window.content.document, special);
}, },
{ bang: true, }); {
argCount: "0",
bang: true
});
liberator.commands.add(["st[op]"], liberator.commands.add(["st[op]"],
"Stop loading", "Stop loading",
@@ -795,7 +801,10 @@ liberator.Buffer = function () //{{{
liberator.commands.add(["vie[wsource]"], liberator.commands.add(["vie[wsource]"],
"View source code of current document", "View source code of current document",
function (args, special) { liberator.buffer.viewSource(args, special); }, function (args, special) { liberator.buffer.viewSource(args, special); },
{ bang: true }); {
argCount: "1",
bang: true
});
liberator.commands.add(["zo[om]"], liberator.commands.add(["zo[om]"],
"Set zoom value of current web page", "Set zoom value of current web page",

View File

@@ -677,14 +677,11 @@ liberator.Events = function () //{{{
liberator.commands.add(["delmac[ros]"], liberator.commands.add(["delmac[ros]"],
"Delete macros", "Delete macros",
function (args) function (args) { liberator.events.deleteMacros(args); },
{ {
if (!args) argCount: "+", // pattern might contain whitespace
liberator.echoerr("E474: Invalid argument"); completer: function (filter) liberator.completion.macro(filter)
else });
liberator.events.deleteMacros(args);
},
{ completer: function (filter) liberator.completion.macro(filter) });
liberator.commands.add(["macros"], liberator.commands.add(["macros"],
"List all macros", "List all macros",
@@ -698,14 +695,11 @@ liberator.Events = function () //{{{
liberator.commands.add(["pl[ay]"], liberator.commands.add(["pl[ay]"],
"Replay a recorded macro", "Replay a recorded macro",
function (args) function (args) { liberator.events.playMacro(args); },
{ {
if (!args) argCount: "1",
liberator.echoerr("E474: Invalid argument"); completer: function (filter) liberator.completion.macro(filter)
else });
liberator.events.playMacro(args);
},
{ completer: function (filter) liberator.completion.macro(filter) });
/////////////////////////////////////////////////////////////////////////////}}} /////////////////////////////////////////////////////////////////////////////}}}
////////////////////// PUBLIC SECTION ////////////////////////////////////////// ////////////////////// PUBLIC SECTION //////////////////////////////////////////

View File

@@ -178,13 +178,10 @@ liberator.IO = function () //{{{
}, },
{ completer: function (filter) liberator.completion.file(filter, true) }); { completer: function (filter) liberator.completion.file(filter, true) });
// NOTE: this command is only used in :source
liberator.commands.add(["fini[sh]"], liberator.commands.add(["fini[sh]"],
"Stop sourcing a script file", "Stop sourcing a script file",
function () function () { liberator.echoerr("E168: :finish used outside of a sourced file"); },
{
// this command is only used in :source
liberator.echoerr("E168: :finish used outside of a sourced file");
},
{ argCount: "0" }); { argCount: "0" });
liberator.commands.add(["pw[d]"], liberator.commands.add(["pw[d]"],

View File

@@ -188,7 +188,10 @@ const liberator = (function () //{{{
return [0, liberator.completion.filter(liberator.config.dialogs || [], filter)]; return [0, liberator.completion.filter(liberator.config.dialogs || [], filter)];
} }
}, },
{ bang: true }); {
argCount: "1",
bang: true
});
// TODO: move this // TODO: move this
function getMenuItems() function getMenuItems()
@@ -485,6 +488,7 @@ const liberator = (function () //{{{
} }
}, },
{ {
argCount: "+",
bang: true, bang: true,
completer: function (filter) completer: function (filter)
{ {

View File

@@ -358,7 +358,10 @@ liberator.Tabs = function () //{{{
liberator.execute(args); liberator.execute(args);
liberator.forceNewTab = false; liberator.forceNewTab = false;
}, },
{ completer: function (filter) liberator.completion.ex(filter) }); {
argCount: "+",
completer: function (filter) liberator.completion.ex(filter)
});
liberator.commands.add(["tabl[ast]", "bl[ast]"], liberator.commands.add(["tabl[ast]", "bl[ast]"],
"Switch to the last tab", "Switch to the last tab",

View File

@@ -302,7 +302,7 @@ liberator.config = { //{{{
"Close the sidebar window", "Close the sidebar window",
function () function ()
{ {
if (document.getElementById("sidebar-box").hidden == false) if (!document.getElementById("sidebar-box").hidden)
toggleSidebar(); toggleSidebar();
}, },
{ argCount: "0" }); { argCount: "0" });

View File

@@ -24,7 +24,7 @@ ________________________________________________________________________________
|:delmac| |:delmacros| |:delmac| |:delmacros|
||:delmac[ros] [args]|| + ||:delmac[ros] {args}|| +
________________________________________________________________________________ ________________________________________________________________________________
Delete recorded macros matching the regular expression [args]. Delete recorded macros matching the regular expression [args].
________________________________________________________________________________ ________________________________________________________________________________