Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor CLI code to get babel-ified and generally be more maintainable #114

Merged
merged 6 commits into from
Mar 9, 2019

Conversation

dhleong
Copy link
Owner

@dhleong dhleong commented Mar 9, 2019

Closes #108

I don't anticipate adding any new commands, but #40 has been around for a while and should become fairly trivial to implement with this refactor. Also, now that commands are fairly trivially testable it would be less painful for someone to look into #104.

Besides, let's be honest... the old code was pretty much garbage. This is at least somewhat better. There's still a bunch of code that's begging to be cleaned up (Waker in particular is nasty) but it's functional, so let's not take on unnecessary risk by trying to rewrite it. This code did actually have some bugs (see #113) and otherwise blocked other issues (as mentioned above) so it was worth doing.

Refs #108

The general approach here is that each command should be simple to write
with an easy means of operating against a provided UI and device. That
way we can test against mocks/fakes and also easily swap out a different
"UI" implementation. I don't plan to add a GUI, but this would make it
easier to support `--json` mode, or even possibly a headless stdin-based
daemon mode.

I've decided against oclif because it just seems like too much, but
commander.js or yargs seem like good options.
Refs #108

Yargs has some great stuff but I don't like how it renders the options
info. Commander.js seems very close, but it doesn't wrap descriptions at
all. docopt and neodoc seem neat but don't let us nicely and succinctly
describe what each command does.

Minimist is simple and easy, and doesn't introduce any new dependency
overhead, so let's just stick with it!
@dhleong dhleong merged commit 3ba552f into master Mar 9, 2019
@dhleong dhleong deleted the dhleong/cli-refactor branch March 9, 2019 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant