1 // Copyright (c) 2009 by Doug Kearns
3 // This work is licensed for reuse under an MIT license. Details are
4 // given in the LICENSE.txt file included with this file.
7 function reportError(e) {
8 dump("dactyl: command-line-handler: " + e + "\n" + (e.stack || Error().stack));
13 var NAME = "command-line-handler";
14 var Cc = Components.classes;
15 var Ci = Components.interfaces;
16 var Cu = Components.utils;
18 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
20 function CommandLineHandler() {
21 this.wrappedJSObject = this;
23 Cu.import("resource://dactyl/base.jsm");
24 require(global, "util");
25 require(global, "config");
27 CommandLineHandler.prototype = {
29 classDescription: "Dactyl Command-line Handler",
31 classID: Components.ID("{16dc34f7-6d22-4aa4-a67f-2921fb5dcb69}"),
33 contractID: "@mozilla.org/commandlinehandler/general-startup;1?type=dactyl",
36 category: "command-line-handler",
40 QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsICommandLineHandler]),
42 handle: function (commandLine) {
44 // TODO: handle remote launches differently?
46 this.optionValue = commandLine.handleFlagWithParam(config.name, false);
49 util.dump("option '-" + config.name + "' requires an argument\n");
53 get helpInfo() " -" + config.name + " <opts>" + " Additional options for " + config.appName + " startup\n".substr(config.name.length)
56 if (XPCOMUtils.generateNSGetFactory)
57 var NSGetFactory = XPCOMUtils.generateNSGetFactory([CommandLineHandler]);
59 var NSGetModule = XPCOMUtils.generateNSGetModule([CommandLineHandler]);
60 var EXPORTED_SYMBOLS = ["NSGetFactory", "global"];
62 // vim: set fdm=marker sw=4 ts=4 et: