tpope / rbenv-aliases

Create aliases for rbenv Ruby versions
MIT License
127 stars 18 forks source link

Help usage and shellcheck fixes #11

Closed jasonkarns closed 8 years ago

jasonkarns commented 8 years ago

shellcheck fixes

fixed some things that shellcheck static analysis found

only print --usage help, not entire help output when given unknown args

remove extraneous 'exec'

Tests are failing on master and failing for identical reasons on this branch.

tpope commented 8 years ago

The --usage addition makes sense, and the replacement of sed is a nice touch. I'm not sure about the rest.

jasonkarns commented 8 years ago

Most the changes (except exec), were caught with the shellcheck tool.

tpope commented 8 years ago
jasonkarns commented 8 years ago

If help is invoked due to invalid arguments, the exit status should be a failure, actually. So we should drop the exec and add an exit 1 afterwards (which means expanding the || case to a proper if).

good call

sed doesn't read arguments from stdin so I don't understand your concern about piping here.

yep, brain fart

I don't think stylistic preference is reason enough to change existing, functioning code in either of these cases.

legit

Changes forthcoming

jasonkarns commented 8 years ago
jasonkarns commented 8 years ago

also created and refactored to a separate fail helper function to handle printing an error message to stderr and exiting with 1. pushed in separate branch. can merge to this pr if desired or open separate pr.

https://github.com/jasonkarns/rbenv-aliases/compare/help-usage...jasonkarns:fail-helper

tpope commented 8 years ago

Please clean up the history. One commit would be fine or you can try to split it into a small number.

jasonkarns commented 8 years ago

Do you want the fail-helper refactor included or no?

tpope commented 8 years ago

Uh I guess leave it out for now.

jasonkarns commented 8 years ago

squashed to 3 commits