New Firefox Command Line for Developers

Joe Walker

17

There are many many tools and features that we’d like to add to Firefox developer tools, but if we do them all, there’s a risk that the interface will get really messy. So we’re creating a command line to help us contain the small tools. It’s quick to use and unlike conventional command lines, it helps you out, rather than requiring you to learn command parameters.

The developers toolbar should land in Firefox 16 or 17 and will look like this:

The challenge is creating enough commands: It might be stretching things a little to call the command line a ‘platform’, and commands ‘apps’, but a command line without commands is useless. We’ve created several, and we’re working on more, but we’d still like help.

So we’re planning on a hackathon on 26th June to add to the list of commands and to check that it really as as easy as we think it is to extend.

By the time the 26th rolls around bug 724055 should have landed which will make creating new commands and easy as setting a pref to point to a directory where you have put some JSON (ish) files, describing your commands, and you’re done.

In the next few days I’ll update this post with a set of resources for creating commands and ideas for commands. We’ll hang out in IRC and crank away and see how many commands we can get written in a day.

If you can spare some time, we’d love to have some help.

(Update: Originally this post had a typo and said the 27th. The real date is the 26th)

17 responses

  1. Fernando Cassia wrote on ::

    Excellent!. You know what would be great, then? scripts.
    And the ability to call those from the OS command line before loading Firefox.

    Take this example:

    a sucession of commands like
    LoadURL(url)
    PrintPage(DefaultPrinter or PrinterName)
    CloseBrowser

    save it as script.ff

    Then being able to call firefox script.ff to execute it.

    :)

    FC

    1. Joe Walker wrote on ::

      I don’t want this to compete with JavaScript, but I don’t see why we shouldn’t make the 2 work well together, and if we can make sure we’re not worried about security problems from scripting the browser in this way, then this seems like a nice idea.

      I raised bug 767340 and bug 767342.

      Thanks for the suggestion.

  2. Sarjono wrote on :

    I will love if there’s a command to execute Preferences / Option more easy.

    1. Joe Walker wrote on ::

      There is – ‘pref set browser.download.lastDir /tmp’ for example.

  3. Curci Lucas wrote on ::

    I totally agree, with Fernando, this would make be come back to firefox from chrome ( sorry for my betrayal ;) ).

    But would it be as wide as a greasemonkey script, or for different uses ?

    1. Joe Walker wrote on ::

      You could use it for greasemonkey style scripts, or more, because the scripts run with chrome privilages, you can interact with any part of the browser.

  4. Stephanie Daugherty wrote on ::

    Any relation between this and Ubiquity (https://wiki.mozilla.org/Labs/Ubiquity)? It looks remarkably similar :)

    1. Joe Walker wrote on ::

      Ubiquity was aimed at users, and was free-text, so you typed in English. This was good because it made for (slightly) less to learn, but made it really hard to internationalize.
      This is aimed squarely at developers who get the concept of a command line already.

  5. Julian Viereck wrote on :

    would be cool if one could write new commands using scratch pad and later edit them from there.

    1. Joe Walker wrote on ::

      @Julian – you can do just that. See https://gist.github.com/2944612 for an example (you’ll need to make the scratchpad a chrome for this to work)

  6. Felipe wrote on ::

    First thoughts:
    nogif : stop animated GIFs, apng and alike
    Or maybe stop gif, stop js, etc
    clear cache
    resize 768 (pixel unit by default) with http://paulrouget.com/e/devtoolsupdate/

  7. Fabricio Zuardi wrote on :

    Are we able to use arrow keys to increase and decrease numbers on the style/page inspector yet? :)

    1. kdangoor wrote on :

      Are you asking for a command to increase and decrease values? ;)

      The answer to your question is “not yet”. here’s the bug: https://bugzilla.mozilla.org/show_bug.cgi?id=722691

  8. jcubic wrote on ::

    It would be awesome if you will be able to create commands in javascript and be able to call every function available in the browser, something like Emacs have. Like greasemonkey script that can interact with firefox internals and be accessed from command line.

    1. Joe Walker wrote on ::

      So you’re saying this is awesome then …

  9. and wrote on :

    The “help ” to get help seems old-fashioned (it is carried over from ttys that is “forward only”). But here you can just show the help in the popup window when the command is typed and put any parameters “ghosted” on the line after the typed command (and show help and available values when moving though them).

    Couldn’t this be hacked into a restartless addon so we all can try it out (and it can be iterated faster)?

    1. Joe Walker wrote on ::

      You’re right about help being old-fashioned, and most of me really didn’t want to have a help command, however people do expect that to be there. The first thing you do at any new command line is to type ‘help’, and I didn’t want to start off on the wrong foot.

      We already do some of the ghosting thing, and I’ve put lots of effort into making it helpful without being annoying.

      This command line is already a separate project that can be run in a simple web page, where you can iterate as fast as you like. See https://github.com/joewalker/gcli/ for more.