forked from vimpr/vimperator-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appinfo.js
40 lines (37 loc) · 1.39 KB
/
appinfo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// PLUGIN_INFO//{{{
var PLUGIN_INFO = xml`
<VimperatorPlugin>
<name>{NAME}</name>
<description>show application information</description>
<author mail="[email protected]" homepage="http://d.hatena.ne.jp/hogelog/">hogelog</author>
<version>0.0.1</version>
<minVersion>2.0pre</minVersion>
<maxVersion>2.1</maxVersion>
<license>CC0</license>
<detail><![CDATA[
== COMMANDS ==
appinfo [information]:
echo and copy mozilla information
]]></detail>
</VimperatorPlugin>`;
//}}}
(function() {
const appinfo = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo);
commands.add(['appinfo'], 'show application information',
function(args) {
if (args.length==1) {
util.copyToClipboard(appinfo[args.string], true);
} else {
let descs = [[i,appinfo[i]] for(i in appinfo) if(i!="QueryInterface")];
let list = template.genericTable(descs, { title: ["Application Information", "Value"] });
commandline.echo(list, commandline.HL_INFOMSG);
}
},{
argCount: '?',
completer: function(context, args) {
context.title = ["Application Information", "Value"];
context.completions = [[i,appinfo[i]] for(i in appinfo) if(i!="QueryInterface")];
},
});
})();
// vim: fdm=marker sw=4 ts=4 et: