mozilla/gcli — pull request #52 by Gozala (2012-02-20 02:33:05+00:00)
Title: Pass given options alond to all the components and return view from createView

Hi,

This change does few things:

- [writing-commands](https://github.com/mozilla/gcli/blob/master/docs/writing-commands.md)
documentation in the section **The Command Function (exec)** says that `environment` passed to
the `createView` will be property of `context` that is passed to the command exec. Which is not really
a case. So first commit fixes that.
- `createView` function does not returns anything instead it mutates options. For this reason getting
access to the display element is quite ugly:

```js
var options = { ... }
gcli.createView(options)
var gcliDisplay = options.display
```
Also name suggests that some view will be created which I'd expect in return. Second commit changes
it a bit so that `createView` actually returns some object with display in it.

As general notice I found mutation of options during initialization to be very unpleasant API, this made it
very hard to follow the code to understand what options are used by which component. Also not quite clear
why options serves as a hub here. I would go ahead and clean that up to make code more explicit about
this but I thought I'd check for a feedback first.