More Information

Add-on Compatibility

It's possible to make commands so they can be trivially converted into add-ons. Just use the following template:

Components.utils.import("resource://gre/modules/devtools/gcli.jsm");
varhelloCommandSpec={name:'hello',description:'Show a message',params:[{name:'name',type:'string',description:'Who to say hello to',}],exec:function(args,context){return'Good morning, '+args.name;}}// The boiler plate below allows this module to be exported as a Firefox add-on// If you don't need add-on compatibility, you just need to call// gcli.addCommand(helloCommandSpec);functionstartup(data,reason){gcli.addCommand(helloCommandSpec);}functionshutdown(data,reason){
// addCommand automatically removes any old commands, but to be tidy ...
gcli.removeCommand(helloCommandSpec);}var__SCRATCHPAD__=!(typeof(window)=="undefined");if(__SCRATCHPAD__&&(typeof(window.gBrowser)=="undefined")){thrownewError("Must be run in a browser scratchpad.");}if(__SCRATCHPAD__){shutdown();startup();}functioninstall(data,reason){}functionuninstall(data,reason){}