1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 04:07:58 +01:00

push literalArg onto the end of args.arguments in parseArgs - still a bit of a

mess
This commit is contained in:
Doug Kearns
2008-11-03 06:00:44 +00:00
parent e8cf48af6c
commit 31ba397ff5
6 changed files with 17 additions and 18 deletions

View File

@@ -469,8 +469,9 @@ function Commands() //{{{
if (!argCount)
argCount = "*";
if (literal)
argCount = parseInt(argCount);
var literalIndex = parseInt(argCount) - 1 || 0;
var args = {}; // parsed options
args.arguments = []; // remaining arguments
@@ -594,9 +595,10 @@ function Commands() //{{{
}
}
if (literal && args.arguments.length == argCount)
if (literal && args.arguments.length == literalIndex)
{
args.literalArg = sub;
args.arguments.push(sub);
break;
}
@@ -619,9 +621,6 @@ function Commands() //{{{
i += count; // hopefully count is always > 0, otherwise we get an endless loop
}
if (literal)
return args;
// check for correct number of arguments
if (args.arguments.length == 0 && (argCount == "1" || argCount == "+"))
{
@@ -787,8 +786,7 @@ function Commands() //{{{
}
},
{
literal: true,
argCount: 1,
argCount: "2",
bang: true,
completer: function (filter) completion.userCommand(filter),
options: [
@@ -796,6 +794,7 @@ function Commands() //{{{
[["-bang"], commandManager.OPTION_NOARG],
[["-count"], commandManager.OPTION_NOARG],
],
literal: true,
serial: function () [
{
command: this.name,

View File

@@ -174,7 +174,7 @@ function Editor() //{{{
editor.listAbbreviations(mode, lhs || "");
},
{
argCount: 1,
argCount: "2",
literal: true,
serial: function () [
{

View File

@@ -111,10 +111,10 @@ function AutoCommands() //{{{
}
},
{
argCount: 2,
argCount: "3",
bang: true,
literal: true,
completer: function (filter) completion.event(filter)
completer: function (filter) completion.event(filter),
literal: true
});
// TODO: expand target to all buffers

View File

@@ -180,11 +180,11 @@ function Mappings() //{{{
modeDescription = modeDescription ? " in " + modeDescription + " mode" : "";
const opts = {
argCount: "2",
completer: function (filter) completion.userMapping(filter, modes),
options: [
[["<silent>", "<Silent>"], commands.OPTION_NOARG]
],
argCount: 1,
literal: true,
serial: function () {
let noremap = this.name.indexOf("noremap") > -1;

View File

@@ -429,6 +429,8 @@ liberator.registerObserver("load_commands", function ()
}
},
{
argCount: "2",
bang: true,
completer: function (filter) {
let compl = [];
try
@@ -440,8 +442,6 @@ liberator.registerObserver("load_commands", function ()
comp = compl.concat([[s, ""] for each (s in styles.sites)])
return [0, completion.filter(compl, filter)];
},
argCount: 1,
bang: true,
hereDoc: true,
literal: true,
options: [[["-name", "-n"], commands.OPTION_STRING],
@@ -463,7 +463,7 @@ liberator.registerObserver("load_commands", function ()
styles.removeSheet(args["-name"], args.arguments[0], args.literalArg, args["-index"], false);
},
{
argCount: 1,
argCount: "2",
completer: function (filter) [0, completion.filter(
[[i, <>{s.sites.join(",")}: {s.css.replace("\n", "\\n")}</>]
for ([i, s] in styles.userSheets)
@@ -507,13 +507,13 @@ liberator.registerObserver("load_commands", function ()
liberator.echoerr(error);
},
{
argCount: "2",
bang: true,
// TODO: add this as a standard highlight completion function?
// I agree. It could (should) be much more sophisticated. --Kris
completer: function (filter) [0,
completion.filter([[v.class, ""] for (v in highlight)], filter)
],
argCount: 1,
bang: true,
hereDoc: true,
literal: true,
options: [[["-append", "-a"], commands.OPTION_NOARG]],

View File

@@ -481,7 +481,7 @@ function Tabs() //{{{
"Show a list of all buffers",
function (args) { tabs.list(args.literalArg); },
{
argCount: "0",
argCount: "?",
literal: true
});