-
-
Notifications
You must be signed in to change notification settings - Fork 136
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
Support configuring submit action key in select #163
base: master
Are you sure you want to change the base?
Conversation
Looks like this is breaking |
d9cb837
to
d0bfe5a
Compare
d0bfe5a
to
dce79bf
Compare
I think it's ready now. All feedback on this would be super-appreciated (especially since I'm not very well-versed in Ruby)! It should be easier to review this commit-by-commit, but they can probably all be merged in the end. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Eleni 👋
Thank you for tackling this issue! Apart from small comments, overall, the implementation looks great. It was a pleasure to review.
My main points are:
- to consider another alternative key in place of
:tab
for all the examples and tests, - add
:enter
to the list of recognised default keys - see if
select_key
can accept more than one key
It's up to you really if you wish to split this commit up into a smaller one that deals only with the readme fixes and another that handles the keys specification or you prefer to keep it all together.
Thank you for the feedback @piotrmurach I'll look into making the suggested updates! |
dfc515c
to
636da64
Compare
Hey @piotrmurach ! I have tried to address all the points above, again it may be easier to review per-commit 🙂 |
lib/tty/prompt/list.rb
Outdated
if %i[return enter].include?(key_name) | ||
"Enter" | ||
else | ||
key_name.to_s.split("_").map(&:capitalize).join("+") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought this was a sensible default, as it covers nicely printing most ctrl/shift+ combination keys. The custom labels should allow the user to deal with more thorny cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like it. This works very well for the majority of the cases.
86dee52
to
ecd8bbb
Compare
ecd8bbb
to
3fa9f2c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good. Functionality-wise we're there. I reviewed everything and found few 'nitpicky' things. Let me know what you think and thank you for working on this feature!
lib/tty/prompt/list.rb
Outdated
if %i[return enter].include?(key_name) | ||
"Enter" | ||
else | ||
key_name.to_s.split("_").map(&:capitalize).join("+") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like it. This works very well for the majority of the cases.
fad599f
to
39ed0d1
Compare
Hey @piotrmurach, I have addressed the last round of feedback. Let me know what you think! |
39ed0d1
to
9dea17b
Compare
Hi @Geekfish, nice one! Nearly there. There are still few issues left to do with the yardoc. I think it's best if you run the |
Hey @piotrmurach ! Thanks for the instructions above, I'd never used yard before, I'll fix the warnings. How do you feel about adding these to the gemspec?
+ some extra instructions for contributing? Would it also make sense to have something like pronto-rubocop to check for rubocop issues only on the diffs? Maybe we could do something in a separate PR, I would be happy to give a hand to make contributing easier and require a bit less work from you having to comb through everything :) |
fb77935
to
73c5839
Compare
73c5839
to
7dc89e8
Compare
@piotrmurach I believe I have fixed all the list/multi_list warnings now. |
@Geekfish I can confirm all the warnings for As for adding I'm in favour of adding, for example, |
Hey @piotrmurach, I'm not sure if we're running different versions of
I manually inspected the README and fixed two types of issues I identified with extra backticks and missing newlines (not only in new docs). Am I missing something? Is there a flag / extra gem that I'm missing, so I can get those warnings? When I run |
For clarity, this is my output:
and README only:
|
@Geekfish The
I can also confirm that I'm getting exactly the same output from the yard for the entire project matching yours. So all is good. |
Hey @piotrmurach!
|
@Geekfish It seems that running the |
Interesting, via |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noticed a couple of small readme issues. I'd also like to add keys
yard parameter descriptions for consistency with other methods. I have added them in the comments. This is the end of the amending.
@Geekfish I dug a little into the |
Hey @piotrmurach ! This |
@Geekfish Strangely, these errors are not present on Ruby |
@piotrmurach just a friendly ping to know when this is planned to be merged to update. |
Would be really nice to have this feature :) |
Hi @piotrmurach. I work at Airbnb and we use I came across the same issue today and found that the problem is already solved in this PR. I'd love to help if there's anything I can do for it. Thanks in advance! |
Describe the change
Attempting to address the issue described here, if merged this MR will:
:confirm_keys
option:select_keys
option:space
and:return
for #select:return
for #multi_selectWhy are we doing this?
This is particularly useful for users of the
filter
option, as the current behaviour doesn't allow the user to use spaces in their input.Benefits
Makes the selection filtering behaviour more flexible.
Drawbacks
Since this relies on the key name rather than the value, specific alphanumeric values are not supported.This has been addressed now, alphanumerics are also supported.Requirements
master
branch?