Closed fleischie closed 7 years ago
Haha, the failing tests were "only" broken linting rules and I see CI enforced them. So, yeah. All :white_check_mark: now. :slightly_smiling_face:
One of the latest commits removes the whitespace and the other now highlights the selection in color emoji terminals.
I would like to have the same copy interface for both $ emoj
and $ emoj input
, so either we need to make this one horizontal, or emoj
vertical. I think I prefer horizontal.
We could do something like:
❯ emoj
› horse
🐴 🐎 🏇 🎠 🚴 😍 🚌
^
What do you think?
Yes, I think having a consistent layout makes sense and is preferable. 🙂
The current implementation uses inquirer
and I don't know, whether it has the possibility to inquire horizontally. I will check, though.
You don't need to use Inquirer. Just capture the arrow keys and move the ^
accordingly.
For example: https://github.com/sindresorhus/emoj/blob/2ea3c23667c39c61a5158f2cb815d5490d8b6de4/cli.js#L109
Hello. I addressed the changes:
cli.js
now passes xo && ava
.)inquirer
again, but displayed a selection indicator and track the choice.As I used the plain response from dango (and not coerce it to a string right away), this might be a breaking change from the known internals.
If you need anything, have any comments/requests/opinions/statements about this PR, just let me know. I am available for discussions/modifications of PR/etc.
When I move between the emojis, the indicator (^
) disappears for some milliseconds before it appears in the new position. It should not disappear.
I addressed the indicator issues, but it seems to be not perfectly aligned in all the terminals I have. Hyper for example spaces the emojis farther away, than 3 characters (at least in my setup). iTerm2 looks good though.
Give me an update on what to address and I'll do it. Thank you for your ongoing patience. 🙇
Hey, we decided to rewrite this module using Ink to make the code more readable and maintainable. This, unfortunately, makes your pull request moot. Sorry about that...
Yeah, I already saw some days ago in my twitter feed. 😊
Thanks for taking your time, though. I'll be looking forward to the new implementation.
Hello. :slightly_smiling_face:
This PR is a proposal to fix #2: Check, whether there is a
--copy
flag given and copy the required emoji to the clipboard. For this purpose achoice
parameter can be used to specify the requested index, which defaults to1
.There are several checks in place:
emoj --copy unicorn
- If--copy
is given, but no input, try to usechoice
as input.emoj --copy -5 unicorn
- Clamp the selection between 0 and the returned listslength
.emoj --copy 100 unicorn
- Same as above.Furthermore without the
--copy
flag but with aname
parameteremoji
now utilizesinquirer
to display an interactive selection for the emoji to copy to the clipboard. I found this is a more usable approach to handle an ambiguous result.NOTE: While writing this PR message I noticed there are tests in place, that fail. I will update the PR as soon as possible to fix them. You can check out the current solution in the meantime and give notes. :+1: