summaryrefslogtreecommitdiff
path: root/common/modules/contexts.jsm
diff options
context:
space:
mode:
Diffstat (limited to 'common/modules/contexts.jsm')
-rw-r--r--common/modules/contexts.jsm8
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)
});