mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 08:17:59 +01:00
use parseArgs for 'editor' option
This commit is contained in:
1
NEWS
1
NEWS
@@ -8,6 +8,7 @@
|
||||
generous donation which made this behavior possible)
|
||||
* IMPORTANT: ctrl-x/a never take possible negative URLs into account, it was just
|
||||
too unpredictable
|
||||
* :set editor now accepts quoting/escaping to use an editor with spaces in the path
|
||||
* support for :%foo as a count for commands (not yet widely used)
|
||||
* show informative message when a background tab was loaded, especially useful
|
||||
with a hidden tab bar.
|
||||
|
||||
@@ -1296,7 +1296,7 @@ liberator.Buffer = function () //{{{
|
||||
// TODO: save return value in v:shell_error
|
||||
var newThread = Components.classes["@mozilla.org/thread-manager;1"].getService().newThread(0);
|
||||
var editor = liberator.options["editor"];
|
||||
var args = editor.split(" "); // FIXME: too simple
|
||||
var args = liberator.commands.parseArgs(editor, [], "*", true).arguments;
|
||||
if (args.length < 1)
|
||||
{
|
||||
liberator.echoerr("no editor specified");
|
||||
|
||||
@@ -277,14 +277,16 @@ liberator.Commands = function () //{{{
|
||||
// [["-acceleration"], OPTION_FLOAT],
|
||||
// [["-accessories"], OPTION_LIST, null, ["foo", "bar"]],
|
||||
// [["-other"], OPTION_ANY]];
|
||||
// argCount can be:
|
||||
// @param argCount can be:
|
||||
// "0": no arguments
|
||||
// "1": exactly one argument
|
||||
// "+": one or more aguments
|
||||
// "*": zero or more arguments
|
||||
// "?": 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)
|
||||
parseArgs: function(str, options, argCount, allowUnknownOptions)
|
||||
{
|
||||
// returns [count, parsed_argument]
|
||||
function getNextArg(str)
|
||||
@@ -396,7 +398,7 @@ liberator.Commands = function () //{{{
|
||||
args.arguments = []; // remaining arguments
|
||||
|
||||
var invalid = false;
|
||||
var onlyArgumentsRemaining = false; // after a -- has been found
|
||||
var onlyArgumentsRemaining = allowUnknownOptions || false; // after a -- has been found
|
||||
var arg = null;
|
||||
var count = 0; // the length of the argument
|
||||
var i = 0;
|
||||
|
||||
@@ -748,7 +748,7 @@ liberator.Editor = function () //{{{
|
||||
return false;
|
||||
|
||||
var editor = liberator.options["editor"];
|
||||
var args = editor.split(" ");
|
||||
var args = liberator.commands.parseArgs(editor, [], "*", true).arguments;
|
||||
if (args.length < 1)
|
||||
{
|
||||
liberator.echoerr("no editor specified");
|
||||
|
||||
Reference in New Issue
Block a user