rust-lang/rustfix

Use fancy interactive select in CLI

Closed this issue ยท 5 comments

While entering letters to step through suggestions is fun, it might be cooler to have an interactive select box.

The node module inquirer does some cool stuff in that regard, e.g.

or

I think this is a great opportunity to create a new crate. The closest thing I could find in rust (without going all the way to curses-rs) is this snippet which uses termbox-bindings. termion, a pure-rust termbox clone, might also be interesting.

The first one looks like it only works with arrows. That's not so great IMO. I'd prefer to only have to type one of โ€œrsqโ€ without the need for Enter.

Yeah, I'd like to have both options (select with up/down, then enter; or
press one of rscaq) as well.

Personally I also hope we can get to a point where it makes sense to always
press enter to accept the preselected "replace", though ๐Ÿ˜„

Martin Carton notifications@github.com schrieb am Mo. 11. Juli 2016 um
16:44:

The first one looks like it only works with arrows. That's not so great
IMO. I'd prefer to only have to type one of โ€œrsqโ€ without the need for
Enter.

โ€”
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/killercup/rustfix/issues/15#issuecomment-231755988,
or mute the thread
https://github.com/notifications/unsubscribe/AABOX9Bz_UG1XBKaQw9v_IjlOfkc7JYRks5qUlbigaJpZM4JJat1
.

Personally I also hope we can get to a point where it makes sense to always press enter to accept the preselected "replace", though ๐Ÿ˜„

I'm not so sure this would be possible. For some lints the suggestion could be applied as is, 99.9% of the cases. But for some lints, the suggestion really is just a suggestion.

Ha, let me propose an --do-your-best option, then: Apply one
suggestions, run cargo test, keep it if the tests still work, reject it
otherwise. Repeat for all suggestions. Tag line: "Run this over lunch and
impress your boss!" ๐Ÿ˜‰

Martin Carton notifications@github.com schrieb am Mo. 11. Juli 2016 um
16:56:

Personally I also hope we can get to a point where it makes sense to
always press enter to accept the preselected "replace", though ๐Ÿ˜„

I'm not so sure this would be possible. For some lints the suggestion
could be applied as is, 99.9% of the cases. But for some lints, the
suggestion really is just a suggestion.

โ€”
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/killercup/rustfix/issues/15#issuecomment-231759642,
or mute the thread
https://github.com/notifications/unsubscribe/AABOX64CU0pi2W7tY9Br9Vqi-RE6Ruwpks5qUlmlgaJpZM4JJat1
.

I started working on a prototype for this. I'll see if I can get it up on github sometime within this week.