diff options
author | Kris Maglione <maglione.k@gmail.com> | 2011-08-23 22:42:38 -0400 |
---|---|---|
committer | Kris Maglione <maglione.k@gmail.com> | 2011-08-23 22:42:38 -0400 |
commit | 435f30f7eb0446d7834e0ededd9fd12237ffcfd8 (patch) | |
tree | 17ed64428efe8972f67f07f3cb25ce7b70fe6ba1 /common/modules/contexts.jsm | |
parent | 9ad4be54a98fc2b069095a572744618695c4adb3 (diff) | |
download | pentadactyl-435f30f7eb0446d7834e0ededd9fd12237ffcfd8.tar.gz |
First work towards group-local option values.
Diffstat (limited to 'common/modules/contexts.jsm')
-rw-r--r-- | common/modules/contexts.jsm | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/common/modules/contexts.jsm b/common/modules/contexts.jsm index 85525269..9596b8cd 100644 --- a/common/modules/contexts.jsm +++ b/common/modules/contexts.jsm @@ -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) }); |