converters-657595: Up-front refactoring

Some changes that are tangentially related to this bug. i.e. not a
direct part of the fix, but a helpful precursor.
- Add requisition.context, and easy way to get at an ExecutionContext
  from a requisition
- Remove the data passed to the resolve of the output object. The data
  exists on the output object itself, and it has proved to be confusing
  in a number of cases.
- Commands that return View objects (it be templated) should declare a
  returnType of 'view' rather than 'html'
- Rename outputData to output in output_terminal. It's called output
  everywhere else. (also fix some indentation)
- Remove function names from pref.js - We don't use them anywhere else
  and the debugger does this for us now. Also remove some superfluous
  returns
- Refactor the bugs command to use promises in a better way.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
converters-657595: Be clearer about returnType

Don't default the returnType to string for new commands, if the
returnType is not specified, we can do better with a dynamic 'typeof x'.

Add a typedData function to Execution context to allow commands to set
the type of the output at runtime with "context.typedData(data, type)"

Have Output store the type of the data using the following sources:
- Dynamically set type info (i.e context.typedData)
- Command meta-data (i.e. returnType in the command spec)
- "typeof x" from the actual data

Signed-off-by: Joe Walker <jwalker@mozilla.com>
converters-657595: Add new converter system

The new 'converters.js' contains the meat of the change (and the meat of
this branch) It does the job of Output.toDom and Output.toString but is
configurable by adding new converters (so we expose addConverter and
removeConverter to the outside world)

Terminal, helpers and the server all need updating to use the new way
of converting the output, and we move the link retargeting function to
util.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
converters-657595: Update bugz and pref commands

Both now separate the production of data from the conversion to a view
so the Output object holds the raw data and can convert it as required.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
converters-657595: Better error handling for promises

Previously we were using console.error as the handler for rejected
promises, but this is broken on chrome (console functions not bound) and
it doesn't show stack traces on node, so we introduce a custom error
handler to fix this.

Also completer was handling promises badly, by just logging on error
rather than passing the errors on to the promises that it creates. So
we also update the error handling there.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
converters-657595: Make 'convert' asynchronous

I'm not sure if converters will need to be asynchronous in the future.
It is entirely possible that some conversion might need to load some
resource, or lookup some state, so I'm allowing it now since it's not
many extra lines of code.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
converters-657595: Unindent intro.js

intro.js was previously indented, unlike all other significant modules
in gcli.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
converters-657595: Export converters to Firefox

Signed-off-by: Joe Walker <jwalker@mozilla.com>
groupname-850929: Add simpler way to declare options

Now We can specify that a parameter is optional using the much simpler
option:true, or option:'Advanced' syntax.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
prefname-767669: Show the pref name next to the pref value

Tidy-up from contribution made to mozilla-central originally by Jonathan
Vieyra and a surprising number of contributors given such a minor
change.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
Merge branch 'prefname-767669'
Merge branch 'groupname-850929'
Merge branch 'converters-657595'

Conflicts:
	lib/gcli/commands/pref.js