summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorDoug Kearns <dougkearns@gmail.com>2011-07-05 19:33:46 +1000
committerDoug Kearns <dougkearns@gmail.com>2011-07-05 19:33:46 +1000
commit20cc063b687d1db1f978c0a45607863b3a33f096 (patch)
treeede6392ddb5fe2528e11bce833b7b2bf8a83378e /common
parent905c571b312e8d29ccacc8344302c472a47184c7 (diff)
downloadpentadactyl-20cc063b687d1db1f978c0a45607863b3a33f096.tar.gz
Add bang support to :delgroup to delete all groups.
Diffstat (limited to 'common')
-rw-r--r--common/locale/en-US/repeat.xml5
-rw-r--r--common/modules/contexts.jsm15
2 files changed, 16 insertions, 4 deletions
diff --git a/common/locale/en-US/repeat.xml b/common/locale/en-US/repeat.xml
index 41db7e4b..cc44e4d6 100644
--- a/common/locale/en-US/repeat.xml
+++ b/common/locale/en-US/repeat.xml
@@ -189,10 +189,13 @@
</item>
<item>
+ <tags>:delgr :delgroup</tags>
<spec>:delgr<oa>oup</oa> <a>group</a></spec>
+ <spec>:delgr<oa>oup</oa>!</spec>
<description>
<p>
- Delete the specified <a>group</a>.
+ Delete the specified <a>group</a>. With <oa>!</oa> delete all
+ user groups.
</p>
</description>
</item>
diff --git a/common/modules/contexts.jsm b/common/modules/contexts.jsm
index febafca4..d4df4a8f 100644
--- a/common/modules/contexts.jsm
+++ b/common/modules/contexts.jsm
@@ -570,12 +570,21 @@ var Contexts = Module("contexts", {
commands.add(["delg[roup]"],
"Delete a group",
function (args) {
- util.assert(contexts.getGroup(args[0]), _("group.noSuch", args[0]));
- contexts.removeGroup(args[0]);
+ util.assert(args.bang ^ !!args[0], _("error.argumentOrBang"));
+
+ if (args.bang)
+ contexts.groupList = contexts.groupList.filter(function (g) g.builtin);
+ else {
+ util.assert(contexts.getGroup(args[0]), _("group.noSuch", args[0]));
+ contexts.removeGroup(args[0]);
+ }
},
{
- argCount: "1",
+ argCount: "?",
+ bang: true,
completer: function (context, args) {
+ if (args.bang)
+ return;
modules.completion.group(context);
context.filters.push(function ({ item }) !item.builtin);
}