1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 22:42:26 +01:00

Fix :se all

This commit is contained in:
Kris Maglione
2008-10-10 03:02:19 +00:00
parent 602c89fc12
commit f771b5e25e

View File

@@ -420,38 +420,37 @@ liberator.Options = function () //{{{
{ {
let ret = {}; let ret = {};
[matches, prefix, ret.name, postfix, valueGiven, ret.operator, ret.value] =
args.match(/^\s*(no|inv)?([a-z_]+)([?&!])?\s*(([-+^]?)=(.*))?\s*$/) || [];
ret.args = args; ret.args = args;
ret.onlyNonDefault = false; // used for :set to print non-default options ret.onlyNonDefault = false; // used for :set to print non-default options
if (!args) if (!args)
{ {
ret.args = "all"; ret.name = "all";
ret.onlyNonDefault = true; ret.onlyNonDefault = true;
} }
[matches, prefix, ret.name, postfix, valueGiven, ret.operator, ret.value] =
args.match(/^\s*(no|inv)?([a-z_]+)([?&!])?\s*(([-+^]?)=(.*))?\s*$/) || [];
ret.prefix = prefix; ret.prefix = prefix;
ret.postfix = postfix; ret.postfix = postfix;
if (!matches)
return null;
ret.scope = modifiers && modifiers.scope;
ret.option = liberator.options.get(ret.name, ret.scope);
ret.all = (ret.name == "all") ret.all = (ret.name == "all")
ret.get = (ret.all || postfix == "?" || (ret.option && ret.option.type != "boolean" && !valueGiven)) ret.get = (ret.all || postfix == "?" || (ret.option && ret.option.type != "boolean" && !valueGiven))
ret.invert = (prefix == "inv" || postfix == "!"); ret.invert = (prefix == "inv" || postfix == "!");
ret.reset = (postfix == "&"); ret.reset = (postfix == "&");
ret.unsetBoolean = (prefix == "no"); ret.unsetBoolean = (prefix == "no");
if (ret.value === undefined) ret.scope = modifiers && modifiers.scope;
ret.value = "";
if (matches)
ret.option = liberator.options.get(ret.name, ret.scope);
if (!ret.option) if (!ret.option)
return ret; return ret;
if (ret.value === undefined)
ret.value = "";
ret.optionValue = ret.option.get(ret.scope); ret.optionValue = ret.option.get(ret.scope);
switch (ret.option.type) switch (ret.option.type)
@@ -530,7 +529,7 @@ liberator.Options = function () //{{{
} }
let option = opt.option; let option = opt.option;
if (option == null) if (option == null && !opt.all)
{ {
liberator.echoerr("No such option: " + opt.name); liberator.echoerr("No such option: " + opt.name);
return; return;
@@ -554,7 +553,7 @@ liberator.Options = function () //{{{
{ {
if (opt.all) if (opt.all)
{ {
liberator.options.list(opt.onlyNonDefault, scope); liberator.options.list(opt.onlyNonDefault, opt.scope);
} }
else else
{ {