Ok I was curious to dig a little bit to see if i could add one. I found this nice article on dxr - https://dxr.mozilla.org/mozilla-central/source/devtools/shared/gcli/source/docs/writing-commands.md
I tried some stuff quickly but it’s not working on my first try, try digging around here:
var { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
const { createSystem, connectFront, disconnectFront } = require("gcli/system");
const { GcliFront } = require("devtools/server/actors/gcli");
require('gcli/index')
var mySystem = createSystem({location:'client'})
mySystem.addItems([{
name: 'greet',
description: 'Show a greeting',
params: [
{
name: 'name',
type: 'string',
description: 'The name to greet'
}
],
returnType: 'string',
exec: function(args, context) {
return 'Hello, ' + args.name;
}
}]);
But that fails saying “type string” is invalid. And also I’m not sure if this affects the commands inputable to the developer toolbar. I think I might be making a new “system” and adding commands to that. Not sure.
I found a getSystem
function here - https://dxr.mozilla.org/mozilla-central/source/devtools/shared/gcli/commands/index.js#110
So called it in like this:
require(‘devtools/shared/gcli/commands/index’)
But couldn’t figure out how to give it a target.
I found that this
var tmp = {};
Cu.import("resource://devtools/client/shared/DeveloperToolbar.jsm", tmp);
var a = new tmp.DeveloperToolbar(window, document.getElementById("developer-toolbar"));
That gives you a like the current dev toolbar but then I cant figure out how to run getSystem
on it.