aws/aws-cli — pull request #123 by jamesls (2013-05-20 22:07:13+00:00)
Title: Cleanup error message when specifying invalid choice

This adds some basic formatting so choices are presented like:
```
operation-name1 | operation-name2
operation-name3 | operation-name4
longer-operation-name5 | operation-name6
```
I set the number of choices per line to be 2, which at 40 chars width
(which works for the majority of services) will still look ok
for people with 80 char width terminals. Bumping up to 3 choices
per line looks good as well, except it requires 120 chars of space.

I've also added an auto suggest so that if you mistype a command we
try to offer suggestions to use, so for example you'll now get something
like:
```
Invalid choice: 'list-buckest', maybe you meant:

* list-buckets
```
I'm using the built in get_close_matches which isn't based on the
minimal edit distance, but setting a threshold to 0.8 similarity
seemed to work well in practice, and we don't have to include our own
levenshtein distance function.

Sample full output:

```
$ aws s3 list-objecst

aws [options] [parameters]

aws s3: error: argument operation: Invalid choice, valid choices are:

abort-multipart-upload | complete-multipart-upload
copy-object | create-bucket
create-multipart-upload | delete-bucket
delete-bucket-cors | delete-bucket-lifecycle
delete-bucket-policy | delete-bucket-tagging
delete-bucket-website | delete-object
delete-objects | get-bucket-acl
get-bucket-cors | get-bucket-lifecycle
get-bucket-location | get-bucket-logging
get-bucket-notification | get-bucket-policy
get-bucket-request-payment | get-bucket-tagging
get-bucket-versioning | get-bucket-website
get-object | get-object-acl
get-object-torrent | head-bucket
head-object | list-buckets
list-multipart-uploads | list-object-versions
list-objects | list-parts
put-bucket-acl | put-bucket-cors
put-bucket-lifecycle | put-bucket-logging
put-bucket-notification | put-bucket-policy
put-bucket-request-payment | put-bucket-tagging
put-bucket-versioning | put-bucket-website
put-object | put-object-acl
restore-object | upload-part
upload-part-copy | help

Invalid choice: 'list-objecst', maybe you meant:

* list-objects
```

cc @garnaat @toastdriven