X-Git-Url: https://git.donarmstrong.com/?p=dactyl.git;a=blobdiff_plain;f=common%2Fcontent%2Fautocommands.js;h=beb8fc52e2a199bd5fefab0ed1fa3f1e2d452679;hp=2d960c835be66b75f59a9c4fb274eea449fe38d3;hb=70740024f9c028c1fd63e1a1850ab062ff956054;hpb=eeed0be1a8abf7e3c97f43b63c1d595e940fef21 diff --git a/common/content/autocommands.js b/common/content/autocommands.js index 2d960c8..beb8fc5 100644 --- a/common/content/autocommands.js +++ b/common/content/autocommands.js @@ -47,7 +47,7 @@ var AutoCmdHive = Class("AutoCmdHive", Contexts.Hive, { * * @param {string} event The event name filter. * @param {string} pattern The URL pattern filter. - * @returns {AutoCommand[]} + * @returns {[AutoCommand]} */ get: function (event, pattern) { return this._store.filter(function (autoCmd) autoCmd.match(event, regexp)); @@ -84,12 +84,17 @@ var AutoCommands = Module("autocommands", { remove: deprecated("group.autocmd.remove", { get: function remove() autocommands.user.closure.remove }), /** - * Lists all autocommands with a matching *event* and *regexp*. + * Lists all autocommands with a matching *event*, *regexp* and optionally + * *hives*. * * @param {string} event The event name filter. * @param {string} regexp The URL pattern filter. + * @param {[Hive]} hives List of hives. + * @optional */ - list: function (event, regexp) { + list: function (event, regexp, hives) { + + let hives = hives || this.activeHives; function cmds(hive) { let cmds = {}; @@ -108,7 +113,7 @@ var AutoCommands = Module("autocommands", { ----- Auto Commands ----- { - template.map(this.activeHives, function (hive) + template.map(hives, function (hive) {hive.name} + @@ -143,7 +148,7 @@ var AutoCommands = Module("autocommands", { let lastPattern = null; var { url, doc } = args; if (url) - uri = util.newURI(url); + uri = util.createURI(url); else var { uri, doc } = buffer; @@ -200,7 +205,7 @@ var AutoCommands = Module("autocommands", { args["-group"].remove(event, regexp); // remove all } else - autocommands.list(event, regexp); // list all + autocommands.list(event, regexp, args.explicitOpts["-group"] ? [args["-group"]] : null); // list all } }, { bang: true,