aboutsummaryrefslogtreecommitdiffstats
path: root/appinfo.js
blob: c7468075d993b928c086f6deabadd4c1f0b267dd (plain)
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 =
<VimperatorPlugin>
    <name>{NAME}</name>
    <description>show application information</description>
    <author mail="konbu.komuro@gmail.com" 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: