mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 09:27:58 +01:00
Move getNextArg() to commands.parseArg so I can override it in rcquotes.js plugin
This commit is contained in:
@@ -297,32 +297,8 @@ function Commands() //{{{
|
||||
return exCommands.filter(function (cmd) cmd.isUserCommand);
|
||||
},
|
||||
|
||||
// in '-quoted strings, only ' and \ itself are escaped
|
||||
// in "-quoted strings, also ", \n and \t are translated
|
||||
// in non-quoted strings everything is taken literally apart from "\ " and "\\"
|
||||
//
|
||||
// @param str: something like "-x=foo -opt=bar arg1 arg2"
|
||||
// "options" is an array [name, type, validator, completions] and could look like:
|
||||
// options = [[["-force"], OPTION_NOARG],
|
||||
// [["-fullscreen", "-f"], OPTION_BOOL],
|
||||
// [["-language"], OPTION_STRING, validateFunc, ["perl", "ruby"]],
|
||||
// [["-speed"], OPTION_INT],
|
||||
// [["-acceleration"], OPTION_FLOAT],
|
||||
// [["-accessories"], OPTION_LIST, null, ["foo", "bar"]],
|
||||
// [["-other"], OPTION_ANY]];
|
||||
// @param argCount can be:
|
||||
// "0": no arguments
|
||||
// "1": exactly one argument
|
||||
// "+": one or more arguments
|
||||
// "*": zero or more arguments (default if unspecified)
|
||||
// "?": zero or one arguments
|
||||
// @param allowUnknownOptions: -foo won't result in an error, if -foo isn't
|
||||
// specified in "options"
|
||||
// TODO: should it handle comments?
|
||||
parseArgs: function (str, options, argCount, allowUnknownOptions, literal, complete, extra)
|
||||
{
|
||||
// returns [count, parsed_argument]
|
||||
function getNextArg(str)
|
||||
parseArg: function getNextArg(str)
|
||||
{
|
||||
var stringDelimiter = null;
|
||||
var escapeNext = false;
|
||||
@@ -408,7 +384,33 @@ function Commands() //{{{
|
||||
return [str.length, arg, "\\"];
|
||||
else
|
||||
return [str.length, arg];
|
||||
}
|
||||
},
|
||||
|
||||
// in '-quoted strings, only ' and \ itself are escaped
|
||||
// in "-quoted strings, also ", \n and \t are translated
|
||||
// in non-quoted strings everything is taken literally apart from "\ " and "\\"
|
||||
//
|
||||
// @param str: something like "-x=foo -opt=bar arg1 arg2"
|
||||
// "options" is an array [name, type, validator, completions] and could look like:
|
||||
// options = [[["-force"], OPTION_NOARG],
|
||||
// [["-fullscreen", "-f"], OPTION_BOOL],
|
||||
// [["-language"], OPTION_STRING, validateFunc, ["perl", "ruby"]],
|
||||
// [["-speed"], OPTION_INT],
|
||||
// [["-acceleration"], OPTION_FLOAT],
|
||||
// [["-accessories"], OPTION_LIST, null, ["foo", "bar"]],
|
||||
// [["-other"], OPTION_ANY]];
|
||||
// @param argCount can be:
|
||||
// "0": no arguments
|
||||
// "1": exactly one argument
|
||||
// "+": one or more arguments
|
||||
// "*": zero or more arguments (default if unspecified)
|
||||
// "?": zero or one arguments
|
||||
// @param allowUnknownOptions: -foo won't result in an error, if -foo isn't
|
||||
// specified in "options"
|
||||
// TODO: should it handle comments?
|
||||
parseArgs: function (str, options, argCount, allowUnknownOptions, literal, complete, extra)
|
||||
{
|
||||
function getNextArg(str) commands.parseArg(str);
|
||||
|
||||
if (!options)
|
||||
options = [];
|
||||
@@ -695,6 +697,8 @@ function Commands() //{{{
|
||||
return [count, cmd, !!special, args || "", heredoc];
|
||||
},
|
||||
|
||||
get complQuote() complQuote,
|
||||
|
||||
get quoteArg() quoteArg,
|
||||
|
||||
removeUserCommand: function (name)
|
||||
|
||||
Reference in New Issue
Block a user