piotrmurach / tty

Toolkit for developing sleek command line apps.
https://ttytoolkit.org
MIT License
2.5k stars 78 forks source link

fail safely on `teletype add` if the current directory is not a teletype app #72

Closed slowbro closed 3 years ago

slowbro commented 3 years ago

Describe the change

Adds a validate_pwd method to the "add" command that makes sure that a gemspec & directory exists before trying to create the command.

Why are we doing this?

A friendly message is better than a stack trace.

Benefits

This will improve user understanding when accidentally trying to run teletype add outside of the project directory.

Should close #62

Drawbacks

There's no way to directly check that the pwd is actually a teletype app, vs another app that happens to have the same structure. However, that was the case before too - this just covers one edge case.

Requirements

Put an X between brackets on each line if you have done the item: [...] Tests written & passing locally? [x] Code style checked? [x] Rebased with master branch? [x] Documentaion updated?

piotrmurach commented 3 years ago

Thank you! ❤️ My plan is to cut a new release this month.