gocardless/atum — pull request #10 by petehamilton (2014-10-10 15:24:11+00:00)
Title: Add a nice CLI interface

@isaacseymour This could maybe be done better, but it means we can do this:

```
> atum new fruity-api
create fruity-api/Gemfile
create fruity-api/Rakefile
create fruity-api/LICENSE.txt
create fruity-api/README.md
create fruity-api/.gitignore
create fruity-api/fruity-api.gemspec
create fruity-api/lib/fruity/api.rb
create fruity-api/lib/fruity/api/version.rb
Initializing git repo in /Users/petehamilton/projects/atum/fruity-api
```

Which will generate a client gem.

We can also call

```atum generate```

within the gem (with several defaults automatically set in an .atum.yml file so we don't need to pass everything on the command line if we don't want to) in order to regenerate the entire client.

On errors, we get nice messages, etc...

```
> atum generate
Error: file must be given (either in .atum.yml or via cli options)

Usage:
atum generate

Options:
-H, [--default-headers=DEFAULT_HEADERS] # A comma separated list of headers, e.g. Api-Version: 2010-10-03, Accept-Language: Fr
[--constant-name=CONSTANT_NAME] # e.g. FruityApi
[--file=FILE]
[--url=URL]
[--gem-name=GEM_NAME]
[--commit], [--no-commit] # Automatically commit the regenerated code

generate the atum client in a lib directory
```

```
> atum help
Commands:
atum help [COMMAND] # Describe available commands or one specific command
atum new # create a new client gem
atum regenerate # regenerate the atum client
atum version # print Atum version

> atum help regenerate
Usage:
atum regenerate

Options:
-H, [--default-headers=DEFAULT_HEADERS] # A comma separated list of headers, e.g. Api-Version: 2010-10-03, Accept-Language: Fr
[--constant-name=CONSTANT_NAME] # e.g. FruityApi
[--file=FILE]
[--url=URL]
[--gem-name=GEM_NAME]
[--commit], [--no-commit] # Automatically commit the regenerated code

regenerate the atum client
```