Commands Refactor Part 2

We split #196 in two parts. this is the second. (#262 is the first). This builds on all the changes to commands/.
Yeah I agree. Let's try to not introduce more ipfs specific things and vendor later

—
Sent from Mailbox

On Tue, Nov 4, 2014 at 3:30 PM, Matt Bell <notifications@github.com>
wrote:

>> +func daemonFunc(res cmds.Response, req cmds.Request) {
>> +	ctx := req.Context()
>> +
>> +	lk, err := daemon.Lock(ctx.ConfigRoot)
>> +	if err != nil {
>> +		res.SetError(fmt.Errorf("Couldn't obtain lock. Is another daemon already running?"), cmds.ErrNormal)
>> +		return
>> +	}
>> +	defer lk.Close()
>> +
>> +	node, err := core.NewIpfsNode(ctx.Config, true)
>> +	if err != nil {
>> +		res.SetError(err, cmds.ErrNormal)
>> +		return
>> +	}
>> +	ctx.Node = node
> Yep, that's the reason I kept all the IPFS-specific stuff contained in the Context, but I'm not sure exactly how we should do it.  Maybe I should just change it to a `map[string]interface{}`? Anyway, I'm not too worried about making the library vendorable right away since making it work with IPFS is higher priority.
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/jbenet/go-ipfs/pull/263/files#r19845198