mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 06:17:58 +01:00
s/args.arguments/args/g
This commit is contained in:
@@ -115,7 +115,7 @@ function Addressbook() //{{{
|
|||||||
"Add an address book entry",
|
"Add an address book entry",
|
||||||
function (args)
|
function (args)
|
||||||
{
|
{
|
||||||
var mailAddr = args.arguments[0]; // TODO: support more than one email address
|
var mailAddr = args[0]; // TODO: support more than one email address
|
||||||
var firstName = args["-firstname"] || null;
|
var firstName = args["-firstname"] || null;
|
||||||
var lastName = args["-lastname"] || null;
|
var lastName = args["-lastname"] || null;
|
||||||
var displayName = args["-name"] || null;
|
var displayName = args["-name"] || null;
|
||||||
|
|||||||
@@ -291,8 +291,8 @@ function Bookmarks() //{{{
|
|||||||
"Add a bookmark",
|
"Add a bookmark",
|
||||||
function (args, special)
|
function (args, special)
|
||||||
{
|
{
|
||||||
var url = args.arguments.length == 0 ? buffer.URL : args.arguments[0];
|
var url = args.length == 0 ? buffer.URL : args[0];
|
||||||
var title = args["-title"] || (args.arguments.length == 0 ? buffer.title : null);
|
var title = args["-title"] || (args.length == 0 ? buffer.title : null);
|
||||||
var keyword = args["-keyword"] || null;
|
var keyword = args["-keyword"] || null;
|
||||||
var tags = args["-tags"] || [];
|
var tags = args["-tags"] || [];
|
||||||
|
|
||||||
@@ -316,7 +316,7 @@ function Bookmarks() //{{{
|
|||||||
"List or open multiple bookmarks",
|
"List or open multiple bookmarks",
|
||||||
function (args, special)
|
function (args, special)
|
||||||
{
|
{
|
||||||
bookmarks.list(args.arguments.join(" "), args["-tags"] || [], special);
|
bookmarks.list(args.join(" "), args["-tags"] || [], special);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
bang: true,
|
bang: true,
|
||||||
|
|||||||
@@ -532,7 +532,7 @@ function Buffer() //{{{
|
|||||||
{
|
{
|
||||||
let doc = window.content.document;
|
let doc = window.content.document;
|
||||||
let chosenData = null;
|
let chosenData = null;
|
||||||
let filename = args.arguments[0];
|
let filename = args[0];
|
||||||
|
|
||||||
if (filename)
|
if (filename)
|
||||||
{
|
{
|
||||||
@@ -577,7 +577,7 @@ function Buffer() //{{{
|
|||||||
|
|
||||||
commands.add(["vie[wsource]"],
|
commands.add(["vie[wsource]"],
|
||||||
"View source code of current document",
|
"View source code of current document",
|
||||||
function (args, special) { buffer.viewSource(args.arguments[0], special); },
|
function (args, special) { buffer.viewSource(args[0], special); },
|
||||||
{
|
{
|
||||||
argCount: "?",
|
argCount: "?",
|
||||||
bang: true,
|
bang: true,
|
||||||
@@ -1523,7 +1523,7 @@ function Marks() //{{{
|
|||||||
"Mark current location within the web page",
|
"Mark current location within the web page",
|
||||||
function (args)
|
function (args)
|
||||||
{
|
{
|
||||||
var mark = args.arguments[0];
|
var mark = args[0];
|
||||||
if (mark.length > 1)
|
if (mark.length > 1)
|
||||||
{
|
{
|
||||||
liberator.echoerr("E488: Trailing characters");
|
liberator.echoerr("E488: Trailing characters");
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ function Commands() //{{{
|
|||||||
let re = RegExp("[" + list + "]", "g");
|
let re = RegExp("[" + list + "]", "g");
|
||||||
return function (str) q + String.replace(str, re, function ($0, $1) $1 in quoteMap ? quoteMap[$1] : "\\" + $1) + q;
|
return function (str) q + String.replace(str, re, function ($0, $1) $1 in quoteMap ? quoteMap[$1] : "\\" + $1) + q;
|
||||||
}
|
}
|
||||||
const _quoteArg = { // FIXME
|
const complQuote = { // FIXME
|
||||||
'"': ['"', quote("", '\n\t"\\\\'), '"'],
|
'"': ['"', quote("", '\n\t"\\\\'), '"'],
|
||||||
"'": ["'", quote("", "\\\\'"), "'"],
|
"'": ["'", quote("", "\\\\'"), "'"],
|
||||||
"": ["", quote("", "\\\\ "), ""]
|
"": ["", quote("", "\\\\ "), ""]
|
||||||
@@ -286,7 +286,7 @@ function Commands() //{{{
|
|||||||
if (val != null)
|
if (val != null)
|
||||||
res.push(quote(val));
|
res.push(quote(val));
|
||||||
}
|
}
|
||||||
for (let [,arg] in Iterator(args.arguments || []))
|
for (let [,arg] in Iterator(args || []))
|
||||||
res.push(quote(arg));
|
res.push(quote(arg));
|
||||||
|
|
||||||
let str = args.literalArg;
|
let str = args.literalArg;
|
||||||
@@ -452,8 +452,7 @@ function Commands() //{{{
|
|||||||
if (!argCount)
|
if (!argCount)
|
||||||
argCount = "*";
|
argCount = "*";
|
||||||
|
|
||||||
var args = {}; // parsed options
|
var args = []; // parsed options
|
||||||
args.arguments = []; // remaining arguments
|
|
||||||
args.string = str; // for access to the unparsed string
|
args.string = str; // for access to the unparsed string
|
||||||
args.literalArg = "";
|
args.literalArg = "";
|
||||||
|
|
||||||
@@ -479,7 +478,7 @@ function Commands() //{{{
|
|||||||
args.completeOpt = null;
|
args.completeOpt = null;
|
||||||
args.completeFilter = null;
|
args.completeFilter = null;
|
||||||
args.completeStart = i;
|
args.completeStart = i;
|
||||||
args.quote = _quoteArg[""];
|
args.quote = complQuote[""];
|
||||||
}
|
}
|
||||||
if (complete)
|
if (complete)
|
||||||
{
|
{
|
||||||
@@ -554,7 +553,7 @@ function Commands() //{{{
|
|||||||
args.completeStart += optname.length + 1;
|
args.completeStart += optname.length + 1;
|
||||||
args.completeOpt = opt;
|
args.completeOpt = opt;
|
||||||
args.completeFilter = arg;
|
args.completeFilter = arg;
|
||||||
args.quote = _quoteArg[quote] || _quoteArg[""];
|
args.quote = complQuote[quote] || complQuote[""];
|
||||||
}
|
}
|
||||||
let type = argTypes[opt[1]];
|
let type = argTypes[opt[1]];
|
||||||
if (type)
|
if (type)
|
||||||
@@ -599,16 +598,16 @@ function Commands() //{{{
|
|||||||
|
|
||||||
if (complete)
|
if (complete)
|
||||||
{
|
{
|
||||||
if (argCount == "0" || args.arguments.length > 0 && (argCount == "1" || argCount == "?"))
|
if (argCount == "0" || args.length > 0 && (argCount == "1" || argCount == "?"))
|
||||||
complete.highlight(i, sub.length, "SPELLCHECK")
|
complete.highlight(i, sub.length, "SPELLCHECK")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (literal && args.arguments.length == literalIndex)
|
if (literal && args.length == literalIndex)
|
||||||
{
|
{
|
||||||
args.literalArg = sub;
|
args.literalArg = sub;
|
||||||
args.arguments.push(sub);
|
args.push(sub);
|
||||||
if (complete)
|
if (complete)
|
||||||
args.completeArg = args.arguments.length - 1;
|
args.completeArg = args.length - 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -616,7 +615,7 @@ function Commands() //{{{
|
|||||||
var [count, arg, quote] = getNextArg(sub);
|
var [count, arg, quote] = getNextArg(sub);
|
||||||
if (complete)
|
if (complete)
|
||||||
{
|
{
|
||||||
args.quote = _quoteArg[quote] || _quoteArg[""];
|
args.quote = complQuote[quote] || complQuote[""];
|
||||||
args.completeFilter = arg || "";
|
args.completeFilter = arg || "";
|
||||||
}
|
}
|
||||||
else if (count == -1)
|
else if (count == -1)
|
||||||
@@ -631,9 +630,9 @@ function Commands() //{{{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (arg != null)
|
if (arg != null)
|
||||||
args.arguments.push(arg);
|
args.push(arg);
|
||||||
if (complete)
|
if (complete)
|
||||||
args.completeArg = args.arguments.length - 1;
|
args.completeArg = args.length - 1;
|
||||||
|
|
||||||
if (count <= 0)
|
if (count <= 0)
|
||||||
break;
|
break;
|
||||||
@@ -662,15 +661,15 @@ function Commands() //{{{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check for correct number of arguments
|
// check for correct number of arguments
|
||||||
if (!complete && (args.arguments.length == 0 && /^[1+]$/.test(argCount) ||
|
if (!complete && (args.length == 0 && /^[1+]$/.test(argCount) ||
|
||||||
// TODO: what is this for? -- djk
|
// TODO: what is this for? -- djk
|
||||||
literal && argCount == "+" && /^\s*$/.test(args.literalArg)))
|
literal && argCount == "+" && /^\s*$/.test(args.literalArg)))
|
||||||
{
|
{
|
||||||
liberator.echoerr("E471: Argument required");
|
liberator.echoerr("E471: Argument required");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else if (args.arguments.length == 1 && (argCount == "0") ||
|
else if (args.length == 1 && (argCount == "0") ||
|
||||||
args.arguments.length > 1 && /^[01?]$/.test(argCount))
|
args.length > 1 && /^[01?]$/.test(argCount))
|
||||||
{
|
{
|
||||||
if (!complete)
|
if (!complete)
|
||||||
liberator.echoerr("E488: Trailing characters");
|
liberator.echoerr("E488: Trailing characters");
|
||||||
@@ -776,7 +775,7 @@ function Commands() //{{{
|
|||||||
"List and define commands",
|
"List and define commands",
|
||||||
function (args, special)
|
function (args, special)
|
||||||
{
|
{
|
||||||
let cmd = args.arguments[0];
|
let cmd = args[0];
|
||||||
|
|
||||||
if (cmd != null && /\W/.test(cmd))
|
if (cmd != null && /\W/.test(cmd))
|
||||||
{
|
{
|
||||||
@@ -899,7 +898,7 @@ function Commands() //{{{
|
|||||||
"Delete the specified user-defined command",
|
"Delete the specified user-defined command",
|
||||||
function (args)
|
function (args)
|
||||||
{
|
{
|
||||||
let name = args.arguments[0];
|
let name = args[0];
|
||||||
|
|
||||||
if (commands.get(name))
|
if (commands.get(name))
|
||||||
commands.removeUserCommand(name);
|
commands.removeUserCommand(name);
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ function Editor() //{{{
|
|||||||
"Abbreviate a key sequence" + modeDescription,
|
"Abbreviate a key sequence" + modeDescription,
|
||||||
function (args)
|
function (args)
|
||||||
{
|
{
|
||||||
let [lhs, rhs] = args.arguments;
|
let [lhs, rhs] = args;
|
||||||
if (rhs)
|
if (rhs)
|
||||||
editor.addAbbreviation(mode, lhs, rhs);
|
editor.addAbbreviation(mode, lhs, rhs);
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ function AutoCommands() //{{{
|
|||||||
"Execute commands automatically on events",
|
"Execute commands automatically on events",
|
||||||
function (args, special)
|
function (args, special)
|
||||||
{
|
{
|
||||||
let [event, regex, cmd] = args.arguments;
|
let [event, regex, cmd] = args;
|
||||||
let events = null;
|
let events = null;
|
||||||
if (event)
|
if (event)
|
||||||
{
|
{
|
||||||
@@ -101,7 +101,7 @@ function AutoCommands() //{{{
|
|||||||
if (special)
|
if (special)
|
||||||
{
|
{
|
||||||
// TODO: "*" only appears to work in Vim when there is a {group} specified
|
// TODO: "*" only appears to work in Vim when there is a {group} specified
|
||||||
if (args.arguments[0] != "*" || regex)
|
if (args[0] != "*" || regex)
|
||||||
autocommands.remove(event, regex); // remove all
|
autocommands.remove(event, regex); // remove all
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -725,7 +725,7 @@ function Events() //{{{
|
|||||||
|
|
||||||
commands.add(["macros"],
|
commands.add(["macros"],
|
||||||
"List all macros",
|
"List all macros",
|
||||||
function (args) { completion.listCompleter("macro", args.arguments[0]) },
|
function (args) { completion.listCompleter("macro", args[0]) },
|
||||||
{
|
{
|
||||||
argCount: "1",
|
argCount: "1",
|
||||||
completer: function (context) completion.macro(context),
|
completer: function (context) completion.macro(context),
|
||||||
@@ -733,7 +733,7 @@ function Events() //{{{
|
|||||||
|
|
||||||
commands.add(["pl[ay]"],
|
commands.add(["pl[ay]"],
|
||||||
"Replay a recorded macro",
|
"Replay a recorded macro",
|
||||||
function (args) { events.playMacro(args.arguments[0]); },
|
function (args) { events.playMacro(args[0]); },
|
||||||
{
|
{
|
||||||
argCount: "1",
|
argCount: "1",
|
||||||
completer: function (context) completion.macro(context)
|
completer: function (context) completion.macro(context)
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ function IO() //{{{
|
|||||||
function (args, special)
|
function (args, special)
|
||||||
{
|
{
|
||||||
// TODO: "E172: Only one file name allowed"
|
// TODO: "E172: Only one file name allowed"
|
||||||
let filename = args.arguments[0] || "~/" + (WINDOWS ? "_" : ".") + EXTENSION_NAME + "rc";
|
let filename = args[0] || "~/" + (WINDOWS ? "_" : ".") + EXTENSION_NAME + "rc";
|
||||||
let file = io.getFile(filename);
|
let file = io.getFile(filename);
|
||||||
|
|
||||||
if (file.exists() && !special)
|
if (file.exists() && !special)
|
||||||
@@ -288,7 +288,7 @@ function IO() //{{{
|
|||||||
|
|
||||||
commands.add(["runt[ime]"],
|
commands.add(["runt[ime]"],
|
||||||
"Source the specified file from each directory in 'runtimepath'",
|
"Source the specified file from each directory in 'runtimepath'",
|
||||||
function (args, special) { io.sourceFromRuntimePath(args.arguments, special); },
|
function (args, special) { io.sourceFromRuntimePath(args, special); },
|
||||||
{
|
{
|
||||||
argCount: "+",
|
argCount: "+",
|
||||||
bang: true
|
bang: true
|
||||||
@@ -311,7 +311,7 @@ function IO() //{{{
|
|||||||
function (args, special)
|
function (args, special)
|
||||||
{
|
{
|
||||||
// FIXME: "E172: Only one file name allowed"
|
// FIXME: "E172: Only one file name allowed"
|
||||||
io.source(args.arguments[0], special);
|
io.source(args[0], special);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
argCount: "1",
|
argCount: "1",
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ const liberator = (function () //{{{
|
|||||||
"Open a " + config.name + " dialog",
|
"Open a " + config.name + " dialog",
|
||||||
function (args)
|
function (args)
|
||||||
{
|
{
|
||||||
args = args.arguments[0];
|
args = args[0];
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -685,14 +685,14 @@ function Mail() //{{{
|
|||||||
function (args)
|
function (args)
|
||||||
{
|
{
|
||||||
var mailargs = {};
|
var mailargs = {};
|
||||||
mailargs.to = args.arguments.join(", ");
|
mailargs.to = args.join(", ");
|
||||||
mailargs.subject = args["-subject"];
|
mailargs.subject = args["-subject"];
|
||||||
mailargs.bcc = args["-bcc"];
|
mailargs.bcc = args["-bcc"];
|
||||||
mailargs.cc = args["-cc"];
|
mailargs.cc = args["-cc"];
|
||||||
mailargs.body = args["-text"];
|
mailargs.body = args["-text"];
|
||||||
mailargs.attachments = args["-attachment"] || [];
|
mailargs.attachments = args["-attachment"] || [];
|
||||||
|
|
||||||
var addresses = args.arguments;
|
var addresses = args;
|
||||||
if (mailargs.bcc)
|
if (mailargs.bcc)
|
||||||
addresses = addresses.concat(mailargs.bcc);
|
addresses = addresses.concat(mailargs.bcc);
|
||||||
if (mailargs.cc)
|
if (mailargs.cc)
|
||||||
|
|||||||
@@ -151,14 +151,14 @@ function Mappings() //{{{
|
|||||||
// 2 args -> map arg1 to arg*
|
// 2 args -> map arg1 to arg*
|
||||||
function map(args, mode, noremap)
|
function map(args, mode, noremap)
|
||||||
{
|
{
|
||||||
if (!args.arguments.length)
|
if (!args.length)
|
||||||
{
|
{
|
||||||
mappings.list(mode);
|
mappings.list(mode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ?:\s+ <- don't remember; (...)? optional = rhs
|
// ?:\s+ <- don't remember; (...)? optional = rhs
|
||||||
let [lhs, rhs] = args.arguments;
|
let [lhs, rhs] = args;
|
||||||
|
|
||||||
if (!rhs) // list the mapping
|
if (!rhs) // list the mapping
|
||||||
{
|
{
|
||||||
@@ -224,7 +224,7 @@ function Mappings() //{{{
|
|||||||
"Remove a mapping" + modeDescription,
|
"Remove a mapping" + modeDescription,
|
||||||
function (args)
|
function (args)
|
||||||
{
|
{
|
||||||
args = args.arguments[0];
|
args = args[0];
|
||||||
|
|
||||||
let found = false;
|
let found = false;
|
||||||
for (let [,mode] in Iterator(modes))
|
for (let [,mode] in Iterator(modes))
|
||||||
|
|||||||
@@ -786,9 +786,9 @@ function Options() //{{{
|
|||||||
|
|
||||||
//var length = names.length;
|
//var length = names.length;
|
||||||
//for (let i = 0, name = names[i]; i < length; name = names[++i])
|
//for (let i = 0, name = names[i]; i < length; name = names[++i])
|
||||||
for (let i = 0; i < args.arguments.length; i++)
|
for (let i = 0; i < args.length; i++)
|
||||||
{
|
{
|
||||||
var name = args.arguments[i];
|
var name = args[i];
|
||||||
var reference = liberator.variableReference(name);
|
var reference = liberator.variableReference(name);
|
||||||
if (!reference[0])
|
if (!reference[0])
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -385,7 +385,7 @@ liberator.registerObserver("load_commands", function ()
|
|||||||
"Load a color scheme",
|
"Load a color scheme",
|
||||||
function (args)
|
function (args)
|
||||||
{
|
{
|
||||||
let scheme = args.arguments[0];
|
let scheme = args[0];
|
||||||
|
|
||||||
if (io.sourceFromRuntimePath(["colors/" + scheme + ".vimp"]))
|
if (io.sourceFromRuntimePath(["colors/" + scheme + ".vimp"]))
|
||||||
autocommands.trigger("ColorScheme", { name: scheme });
|
autocommands.trigger("ColorScheme", { name: scheme });
|
||||||
@@ -401,7 +401,7 @@ liberator.registerObserver("load_commands", function ()
|
|||||||
"Add or list user styles",
|
"Add or list user styles",
|
||||||
function (args, special)
|
function (args, special)
|
||||||
{
|
{
|
||||||
let [filter, css] = args.arguments;
|
let [filter, css] = args;
|
||||||
let name = args["-name"];
|
let name = args["-name"];
|
||||||
|
|
||||||
if (!css)
|
if (!css)
|
||||||
@@ -471,7 +471,7 @@ liberator.registerObserver("load_commands", function ()
|
|||||||
commands.add(["dels[tyle]"],
|
commands.add(["dels[tyle]"],
|
||||||
"Remove a user stylesheet",
|
"Remove a user stylesheet",
|
||||||
function (args) {
|
function (args) {
|
||||||
styles.removeSheet(args["-name"], args.arguments[0], args.literalArg, args["-index"], false);
|
styles.removeSheet(args["-name"], args[0], args.literalArg, args["-index"], false);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
argCount: 2,
|
argCount: 2,
|
||||||
@@ -494,7 +494,7 @@ liberator.registerObserver("load_commands", function ()
|
|||||||
height: 1em !important; min-height: 1em !important; max-height: 1em !important;
|
height: 1em !important; min-height: 1em !important; max-height: 1em !important;
|
||||||
overflow: hidden !important;
|
overflow: hidden !important;
|
||||||
]]>;
|
]]>;
|
||||||
let [key, css] = args.arguments;
|
let [key, css] = args;
|
||||||
if (!css && !(key && special))
|
if (!css && !(key && special))
|
||||||
{
|
{
|
||||||
let str = template.tabular(["Key", "Sample", "CSS"],
|
let str = template.tabular(["Key", "Sample", "CSS"],
|
||||||
@@ -521,7 +521,7 @@ liberator.registerObserver("load_commands", function ()
|
|||||||
context.completions = [[v.class, ""] for (v in highlight)];
|
context.completions = [[v.class, ""] for (v in highlight)];
|
||||||
else if (args.completeArg == 1)
|
else if (args.completeArg == 1)
|
||||||
{
|
{
|
||||||
let hl = highlight.get(args.arguments[0]);
|
let hl = highlight.get(args[0]);
|
||||||
if (hl)
|
if (hl)
|
||||||
context.completions = [[hl.value, "Current Value"], [hl.default || "", "Default Value"]];
|
context.completions = [[hl.value, "Current Value"], [hl.default || "", "Default Value"]];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user