1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 16:07:59 +01:00

Banish old commands.parseArgs prototype.

This commit is contained in:
Kris Maglione
2010-09-24 15:59:51 -04:00
parent 0753c9505e
commit 3645cd27d0
3 changed files with 4 additions and 7 deletions

View File

@@ -561,7 +561,7 @@ const Commands = Module("commands", {
* Args object. * Args object.
* @returns {Args} * @returns {Args}
*/ */
parseArgs: function (str, options, argCount, allowUnknownOptions, literal, complete, extra) { parseArgs: function (str, params) {
function getNextArg(str) { function getNextArg(str) {
let [count, arg, quote] = Commands.parseArg(str, null, keepQuotes); let [count, arg, quote] = Commands.parseArg(str, null, keepQuotes);
if (quote == "\\" && !complete) if (quote == "\\" && !complete)
@@ -571,10 +571,7 @@ const Commands = Module("commands", {
return [count, arg, quote]; return [count, arg, quote];
} }
let keepQuotes; var { allowUnknownOptions, argCount, complete, extra, literal, options, keepQuotes } = params;
if (isObject(options))
({ allowUnknownOptions, argCount, complete, extra, literal, options, keepQuotes }) = options;
if (!options) if (!options)
options = []; options = [];

View File

@@ -1109,7 +1109,7 @@ const Dactyl = Module("dactyl", {
[["+c"], CommandOption.STRING, null, null, true] [["+c"], CommandOption.STRING, null, null, true]
].map(CommandOption.fromArray, CommandOption); ].map(CommandOption.fromArray, CommandOption);
try { try {
return commands.parseArgs(cmdline, options, "*"); return commands.parseArgs(cmdline, { options: options, argCount: "*" });
} }
catch (e) { catch (e) {
dactyl.reportError(e, true); dactyl.reportError(e, true);

View File

@@ -283,7 +283,7 @@ const Editor = Module("editor", {
editFileExternally: function (path) { editFileExternally: function (path) {
// TODO: save return value in v:shell_error // TODO: save return value in v:shell_error
let args = commands.parseArgs(options["editor"], [], "*", true); let args = commands.parseArgs(options["editor"], { argCount: "*", allowUnknownOptions: true });
dactyl.assert(args.length >= 1, "No editor specified"); dactyl.assert(args.length >= 1, "No editor specified");