1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-19 11:15:48 +01:00

First work towards group-local option values.

This commit is contained in:
Kris Maglione
2011-08-23 22:42:38 -04:00
parent 9ad4be54a9
commit 435f30f7eb
7 changed files with 279 additions and 188 deletions

View File

@@ -97,13 +97,15 @@ var Contexts = Module("contexts", {
this.builtin.modifiable = false;
this.GroupFlag = Class("GroupFlag", CommandOption, {
init: function (name) {
init: function (name, defaultValue) {
this.name = name;
this.type = ArgType("group", function (group) {
return isString(group) ? contexts.getGroup(group, name)
: group[name];
});
this.defaultValue = defaultValue;
},
get toStringParams() [this.name],
@@ -112,7 +114,9 @@ var Contexts = Module("contexts", {
description: "Group to which to add",
get default() (contexts.context && contexts.context.group || contexts.user)[this.name],
get default() let (group = contexts.context && contexts.context.group)
!group && this.defaultValue !== undefined ? this.defaultValue
: (group || contexts.user)[this.name],
completer: function (context) modules.completion.group(context)
});