Tidy up CLI

- Allow branch to be determined from the current repo to make
  creating and terminating branch environments easier
- Move non-command functions out of module to make it more obvious that
  this module is all about the CLI.
Add better error reporting

Return easy to understand error messages to the CLI for the types of
errors we expect to ecounter often.

For example errors related to timing (ie. trying to update an
environment before it's finished deploying) or related to trying to
create things that already exist.