1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 16:32:27 +01:00

make use of our argsParser to handle commands with a fixed number of arguments.

Also added args.string to access the original string before it was parsed.
TODO: Always pass a parseArgs-like structure to commands, instead of only
when options or argCount is specified?
This commit is contained in:
Martin Stubenschrott
2008-08-13 21:53:56 +00:00
parent c49ed07af9
commit 1035a01ace
10 changed files with 76 additions and 146 deletions

View File

@@ -1535,24 +1535,21 @@ liberator.Marks = function () //{{{
"Mark current location within the web page",
function (args)
{
if (!args)
{
liberator.echoerr("E471: Argument required");
return;
}
if (args.length > 1)
var mark = args.arguments[0];
if (mark.length > 1)
{
liberator.echoerr("E488: Trailing characters");
return;
}
if (!/[a-zA-Z]/.test(args))
if (!/[a-zA-Z]/.test(mark))
{
liberator.echoerr("E191: Argument must be a letter or forward/backward quote");
return;
}
liberator.marks.add(args);
});
liberator.marks.add(mark);
},
{ argCount: "1" });
liberator.commands.add(["marks"],
"Show all location marks of current web page",