cowboyd/mvcli — pull request #13 by maxlinc (2013-08-19 20:05:16+00:00)
Title: add a REPL-like console

@cowboyd and @krames: here's the console we chatted about recently. It would have some advantages, especially for Rumm, since it can reuse the same connection across multiple commands. Also makes turning Fog.mock! on easier in the future.

Plus, it has autocomplete and command history :)

This is what it should look like:
```bash
>> create server
--> bootstrapping server serious-seance
done.
created server: serious-seance
id: 7e6eb96b-8768-34d4-7270-47b51a14b75e, password: asdfasdfasdf
-> 0
>> show servers
serious-seance -> id: 7e6eb96b-8768-34d4-7270-47b51a14b75e, status: ACTIVE, ipv4:
-> 0
```

And this is how it can be used:
```ruby
#!/usr/bin/env ruby
# -*- mode: ruby -*-
require "mvcli/app"
require "mvcli/console"
require "rumm/version"

module Rumm
class Console < MVCLI::Console
self.root = Pathname(File.expand_path('../../', __FILE__))

# It'd be nice if this was automatic based on routes
commands = File.read(File.expand_path 'app/help/commands.txt', self.root)
commands = commands.lines.select{|l| l =~ /rumm/}
commands = commands.map{|c| c.gsub('rumm', '').strip}

self.commands = commands
end
end

console = Rumm::Console.new(ARGV.dup).execute!
```