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:
@@ -469,8 +469,9 @@ function Commands() //{{{
|
|||||||
|
|
||||||
if (!argCount)
|
if (!argCount)
|
||||||
argCount = "*";
|
argCount = "*";
|
||||||
|
|
||||||
if (literal)
|
if (literal)
|
||||||
argCount = parseInt(argCount);
|
var literalIndex = parseInt(argCount) - 1 || 0;
|
||||||
|
|
||||||
var args = {}; // parsed options
|
var args = {}; // parsed options
|
||||||
args.arguments = []; // remaining arguments
|
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.literalArg = sub;
|
||||||
|
args.arguments.push(sub);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -619,9 +621,6 @@ function Commands() //{{{
|
|||||||
i += count; // hopefully count is always > 0, otherwise we get an endless loop
|
i += count; // hopefully count is always > 0, otherwise we get an endless loop
|
||||||
}
|
}
|
||||||
|
|
||||||
if (literal)
|
|
||||||
return args;
|
|
||||||
|
|
||||||
// check for correct number of arguments
|
// check for correct number of arguments
|
||||||
if (args.arguments.length == 0 && (argCount == "1" || argCount == "+"))
|
if (args.arguments.length == 0 && (argCount == "1" || argCount == "+"))
|
||||||
{
|
{
|
||||||
@@ -787,8 +786,7 @@ function Commands() //{{{
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
literal: true,
|
argCount: "2",
|
||||||
argCount: 1,
|
|
||||||
bang: true,
|
bang: true,
|
||||||
completer: function (filter) completion.userCommand(filter),
|
completer: function (filter) completion.userCommand(filter),
|
||||||
options: [
|
options: [
|
||||||
@@ -796,6 +794,7 @@ function Commands() //{{{
|
|||||||
[["-bang"], commandManager.OPTION_NOARG],
|
[["-bang"], commandManager.OPTION_NOARG],
|
||||||
[["-count"], commandManager.OPTION_NOARG],
|
[["-count"], commandManager.OPTION_NOARG],
|
||||||
],
|
],
|
||||||
|
literal: true,
|
||||||
serial: function () [
|
serial: function () [
|
||||||
{
|
{
|
||||||
command: this.name,
|
command: this.name,
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ function Editor() //{{{
|
|||||||
editor.listAbbreviations(mode, lhs || "");
|
editor.listAbbreviations(mode, lhs || "");
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
argCount: 1,
|
argCount: "2",
|
||||||
literal: true,
|
literal: true,
|
||||||
serial: function () [
|
serial: function () [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -111,10 +111,10 @@ function AutoCommands() //{{{
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
argCount: 2,
|
argCount: "3",
|
||||||
bang: true,
|
bang: true,
|
||||||
literal: true,
|
completer: function (filter) completion.event(filter),
|
||||||
completer: function (filter) completion.event(filter)
|
literal: true
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: expand target to all buffers
|
// TODO: expand target to all buffers
|
||||||
|
|||||||
@@ -180,11 +180,11 @@ function Mappings() //{{{
|
|||||||
modeDescription = modeDescription ? " in " + modeDescription + " mode" : "";
|
modeDescription = modeDescription ? " in " + modeDescription + " mode" : "";
|
||||||
|
|
||||||
const opts = {
|
const opts = {
|
||||||
|
argCount: "2",
|
||||||
completer: function (filter) completion.userMapping(filter, modes),
|
completer: function (filter) completion.userMapping(filter, modes),
|
||||||
options: [
|
options: [
|
||||||
[["<silent>", "<Silent>"], commands.OPTION_NOARG]
|
[["<silent>", "<Silent>"], commands.OPTION_NOARG]
|
||||||
],
|
],
|
||||||
argCount: 1,
|
|
||||||
literal: true,
|
literal: true,
|
||||||
serial: function () {
|
serial: function () {
|
||||||
let noremap = this.name.indexOf("noremap") > -1;
|
let noremap = this.name.indexOf("noremap") > -1;
|
||||||
|
|||||||
@@ -429,6 +429,8 @@ liberator.registerObserver("load_commands", function ()
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
argCount: "2",
|
||||||
|
bang: true,
|
||||||
completer: function (filter) {
|
completer: function (filter) {
|
||||||
let compl = [];
|
let compl = [];
|
||||||
try
|
try
|
||||||
@@ -440,8 +442,6 @@ liberator.registerObserver("load_commands", function ()
|
|||||||
comp = compl.concat([[s, ""] for each (s in styles.sites)])
|
comp = compl.concat([[s, ""] for each (s in styles.sites)])
|
||||||
return [0, completion.filter(compl, filter)];
|
return [0, completion.filter(compl, filter)];
|
||||||
},
|
},
|
||||||
argCount: 1,
|
|
||||||
bang: true,
|
|
||||||
hereDoc: true,
|
hereDoc: true,
|
||||||
literal: true,
|
literal: true,
|
||||||
options: [[["-name", "-n"], commands.OPTION_STRING],
|
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);
|
styles.removeSheet(args["-name"], args.arguments[0], args.literalArg, args["-index"], false);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
argCount: 1,
|
argCount: "2",
|
||||||
completer: function (filter) [0, completion.filter(
|
completer: function (filter) [0, completion.filter(
|
||||||
[[i, <>{s.sites.join(",")}: {s.css.replace("\n", "\\n")}</>]
|
[[i, <>{s.sites.join(",")}: {s.css.replace("\n", "\\n")}</>]
|
||||||
for ([i, s] in styles.userSheets)
|
for ([i, s] in styles.userSheets)
|
||||||
@@ -507,13 +507,13 @@ liberator.registerObserver("load_commands", function ()
|
|||||||
liberator.echoerr(error);
|
liberator.echoerr(error);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
argCount: "2",
|
||||||
|
bang: true,
|
||||||
// TODO: add this as a standard highlight completion function?
|
// TODO: add this as a standard highlight completion function?
|
||||||
// I agree. It could (should) be much more sophisticated. --Kris
|
// I agree. It could (should) be much more sophisticated. --Kris
|
||||||
completer: function (filter) [0,
|
completer: function (filter) [0,
|
||||||
completion.filter([[v.class, ""] for (v in highlight)], filter)
|
completion.filter([[v.class, ""] for (v in highlight)], filter)
|
||||||
],
|
],
|
||||||
argCount: 1,
|
|
||||||
bang: true,
|
|
||||||
hereDoc: true,
|
hereDoc: true,
|
||||||
literal: true,
|
literal: true,
|
||||||
options: [[["-append", "-a"], commands.OPTION_NOARG]],
|
options: [[["-append", "-a"], commands.OPTION_NOARG]],
|
||||||
|
|||||||
@@ -481,7 +481,7 @@ function Tabs() //{{{
|
|||||||
"Show a list of all buffers",
|
"Show a list of all buffers",
|
||||||
function (args) { tabs.list(args.literalArg); },
|
function (args) { tabs.list(args.literalArg); },
|
||||||
{
|
{
|
||||||
argCount: "0",
|
argCount: "?",
|
||||||
literal: true
|
literal: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user