sindresorhus / emoj

Find relevant emoji from text on the command-line :open_mouth: :sparkles: :raised_hands: :horse: :boom: :see_no_evil:
MIT License
2.37k stars 58 forks source link

Add ability to specify number of emojis and update the behavior if stdout is not a TTY #15

Closed isaacd9 closed 7 years ago

isaacd9 commented 8 years ago

These changes are designed to facilitate an easier method for copying emojis to the clipboard with pbcopy (on OSX) or similar tools. If the user is piping the output to another command, only give them a single emoji unless they specify they'd like more. We cap the result at 10.

isaacd9 commented 8 years ago

Not really sure why this claims to be breaking the build...

The return at (what is now) line 51 existed at 80e8db615cdfdfd4b89d9d58d03adef1d854294a as well and the CI build at that rev appears to be passing

sindresorhus commented 8 years ago

Do you have any actual use-case for piping other than copying the emoji? Otherwise I'd prefer to just see https://github.com/sindresorhus/emoj/issues/2 implemented, which would support doing emoj unicorn --copy to copy.

The return at (what is now) line 51 existed at 80e8db6 as well and the CI build at that rev appears to be passing

The linter was upgraded and now correctly disallows top-level return which is invalid in ES2015 modules. That error is covering many other lint violations in your PR though.

isaacd9 commented 8 years ago

Wow, my apologies. I didn't have .editorconfig set up properly and the indentation was incorrect throughout.

That was the use case that comes immediately to mind, especially in the case that I know exactly what emoji I'm looking for and just want to write it to my clipboard.

For example, I feel like it's easier to write out emoj snake | pbcopy and have 🐍 on my clipboard than select the proper emoji from the output with ctrl+1. I'm not sure why this change would influence an implementation of #2 in the future.

sindresorhus commented 8 years ago

For example, I feel like it's easier to write out emoj snake | pbcopy and have 🐍 on my clipboard than select the proper emoji from the output with ctrl+1

I'm suggesting emoj snake --copy or emoj snake -c. Which is both shorter and would work cross-platform.

The interactive part can easily be implemented separately.

isaacd9 commented 8 years ago

Ah, understood.

Something like this?

popey commented 8 years ago

This doesn't seem to work correctly.

$ emoj horse -c 🐴

At this point it just hangs. It does place the horse into the clipboard, but I have to CTRL+C emoj.

$ emoj horse -n 2 🐴 🐎

Also, the -c parameter seems to always drop to 1 result, even if I don't specify -n.