1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-22 15:05:45 +01:00

Normalise command/option/mapping config object param name.

s/extraInfo/extra/
This commit is contained in:
Doug Kearns
2015-07-23 01:19:57 +10:00
parent 779752d776
commit c035aa936b
4 changed files with 26 additions and 26 deletions

View File

@@ -833,7 +833,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
// add mappings for commands like h,j,k,l,etc. in CARET, VISUAL and TEXT_EDIT mode // add mappings for commands like h,j,k,l,etc. in CARET, VISUAL and TEXT_EDIT mode
function addMovementMap(keys, description, hasCount, caretModeMethod, caretModeArg, textEditCommand, visualTextEditCommand) { function addMovementMap(keys, description, hasCount, caretModeMethod, caretModeArg, textEditCommand, visualTextEditCommand) {
let extraInfo = { let extra = {
count: !!hasCount, count: !!hasCount,
type: "operator" type: "operator"
}; };
@@ -872,7 +872,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
} }
} }
}, },
extraInfo); extra);
mappings.add([modes.CARET, modes.TEXT_EDIT, modes.OPERATOR], keys, description, mappings.add([modes.CARET, modes.TEXT_EDIT, modes.OPERATOR], keys, description,
function ({ count }) { function ({ count }) {
@@ -885,7 +885,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
caretExecute(false); caretExecute(false);
} }
}, },
extraInfo); extra);
} }
// add mappings for commands like i,a,s,c,etc. in TEXT_EDIT mode // add mappings for commands like i,a,s,c,etc. in TEXT_EDIT mode

View File

@@ -439,7 +439,7 @@ var Mappings = Module("mappings", {
* @param {string} description A description of the key mapping. * @param {string} description A description of the key mapping.
* @param {function} action The action invoked by each key sequence. * @param {function} action The action invoked by each key sequence.
* @param {Object} extra An optional extra configuration hash (see * @param {Object} extra An optional extra configuration hash (see
* {@link Map#extraInfo}). * {@link Map#extra}).
* @optional * @optional
*/ */
addUserMap: deprecated("group.mappings.add", function addUserMap() { addUserMap: deprecated("group.mappings.add", function addUserMap() {

View File

@@ -113,8 +113,8 @@ update(CommandOption, {
* command name prefix. * command name prefix.
* @param {string} description A short one line description of the command. * @param {string} description A short one line description of the command.
* @param {function} action The action invoked by this command when executed. * @param {function} action The action invoked by this command when executed.
* @param {Object} extraInfo An optional extra configuration hash. The * @param {Object} extra An optional extra configuration hash. The following
* following properties are supported. * properties are supported.
* always - see {@link Command#always} * always - see {@link Command#always}
* argCount - see {@link Command#argCount} * argCount - see {@link Command#argCount}
* bang - see {@link Command#bang} * bang - see {@link Command#bang}
@@ -131,19 +131,19 @@ update(CommandOption, {
* @private * @private
*/ */
var Command = Class("Command", { var Command = Class("Command", {
init: function init(specs, description, action, extraInfo) { init: function init(specs, description, action, extra) {
specs = Array.concat(specs); // XXX specs = Array.concat(specs); // XXX
this.specs = specs; this.specs = specs;
this.description = description; this.description = description;
this.action = action; this.action = action;
if (extraInfo.options) if (extra.options)
this._options = extraInfo.options; this._options = extra.options;
delete extraInfo.options; delete extra.options;
if (extraInfo) if (extra)
this.update(extraInfo); this.update(extra);
}, },
get toStringParams() { return [this.name, this.hive.name]; }, get toStringParams() { return [this.name, this.hive.name]; },

View File

@@ -35,8 +35,8 @@ let ValueError = Class("ValueError", ErrorBase);
* @param {string} description A short one line description of the option. * @param {string} description A short one line description of the option.
* @param {string} type The option's value data type (see {@link Option#type}). * @param {string} type The option's value data type (see {@link Option#type}).
* @param {string} defaultValue The default value for this option. * @param {string} defaultValue The default value for this option.
* @param {Object} extraInfo An optional extra configuration hash. The * @param {Object} extra An optional extra configuration hash. The following
* following properties are supported. * properties are supported.
* completer - see {@link Option#completer} * completer - see {@link Option#completer}
* domains - see {@link Option#domains} * domains - see {@link Option#domains}
* getter - see {@link Option#getter} * getter - see {@link Option#getter}
@@ -50,14 +50,14 @@ let ValueError = Class("ValueError", ErrorBase);
* @private * @private
*/ */
var Option = Class("Option", { var Option = Class("Option", {
init: function init(modules, names, description, defaultValue, extraInfo) { init: function init(modules, names, description, defaultValue, extra) {
this.modules = modules; this.modules = modules;
this.name = names[0]; this.name = names[0];
this.realNames = names; this.realNames = names;
this.description = description; this.description = description;
if (extraInfo) if (extra)
this.update(extraInfo); this.update(extra);
this._defaultValue = defaultValue; this._defaultValue = defaultValue;
@@ -836,8 +836,8 @@ var OptionHive = Class("OptionHive", Contexts.Hive, {
this.has = v => hasOwnProperty(this.values, v); this.has = v => hasOwnProperty(this.values, v);
}, },
add: function add(names, description, type, defaultValue, extraInfo) { add: function add(names, description, type, defaultValue, extra) {
return this.modules.options.add(names, description, type, defaultValue, extraInfo); return this.modules.options.add(names, description, type, defaultValue, extra);
} }
}); });
@@ -952,20 +952,20 @@ var Options = Module("options", {
* @param {string} type The option type (see {@link Option#type}). * @param {string} type The option type (see {@link Option#type}).
* @param {value} defaultValue The option's default value. * @param {value} defaultValue The option's default value.
* @param {Object} extra An optional extra configuration hash (see * @param {Object} extra An optional extra configuration hash (see
* {@link Map#extraInfo}). * {@link Map#extra}).
* @optional * @optional
*/ */
add: function add(names, description, type, defaultValue, extraInfo) { add: function add(names, description, type, defaultValue, extra) {
if (!util.isDactyl(Components.stack.caller)) if (!util.isDactyl(Components.stack.caller))
deprecated.warn(add, "options.add", "group.options.add"); deprecated.warn(add, "options.add", "group.options.add");
util.assert(type in Option.types, _("option.noSuchType", type), util.assert(type in Option.types, _("option.noSuchType", type),
false); false);
if (!extraInfo) if (!extra)
extraInfo = {}; extra = {};
extraInfo.definedAt = contexts.getCaller(Components.stack.caller); extra.definedAt = contexts.getCaller(Components.stack.caller);
let name = names[0]; let name = names[0];
if (name in this._optionMap) { if (name in this._optionMap) {
@@ -976,12 +976,12 @@ var Options = Module("options", {
let closure = () => this._optionMap[name]; let closure = () => this._optionMap[name];
memoize(this._optionMap, name, memoize(this._optionMap, name,
() => Option.types[type](modules, names, description, defaultValue, extraInfo)); () => Option.types[type](modules, names, description, defaultValue, extra));
for (let alias of names.slice(1)) for (let alias of names.slice(1))
memoize(this._optionMap, alias, closure); memoize(this._optionMap, alias, closure);
if (extraInfo.setter && (!extraInfo.scope || extraInfo.scope & Option.SCOPE_GLOBAL)) if (extra.setter && (!extra.scope || extra.scope & Option.SCOPE_GLOBAL))
if (this.dactyl.initialized) if (this.dactyl.initialized)
closure().initValue(); closure().initValue();
else else