GithubHelp home page GithubHelp logo

hugovk / em-keyboard Goto Github PK

View Code? Open in Web Editor NEW
308.0 7.0 31.0 430 KB

The CLI emoji keyboard

License: ISC License

Python 98.09% Shell 1.91%
emoji emoji-picker hacktoberfest cli command-line-interface python terminal

em-keyboard's Introduction

em-keyboard's People

Contributors

cofiem avatar cuducos avatar davidbgk avatar hugovk avatar inishchith avatar judy2k avatar kennethreitz avatar krrish96 avatar peelman avatar pfmoore avatar pranavkrishnan007 avatar pre-commit-ci[bot] avatar renovate[bot] avatar risacan avatar sibson avatar swizzard avatar waynew avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

em-keyboard's Issues

iTerm2 Emoji doublewidth

Just something to be aware of. The next version of iTerm2 will support Unicode 9.0, which makes emoji doublewidth (meaning you don't have to insert spaces between them to make them look good in the Terminal). It already works in the nightly. It has a special escape code you can print https://gitlab.com/gnachman/iterm2/wikis/unicodeversionswitching to enable it. There's also some way to detect if you are in iTerm2 (I don't remember what it is; I think it's another escape sequence).

Failed to launch in CPython 3.5

Using pyvenv :

$ pyvenv-3.5 install em-keyboard
$ em
Traceback (most recent call last):
  File "/opt/pyvenv/em-keyboard/bin/em", line 9, in <module>
    load_entry_point('em-keyboard==0.0.4', 'console_scripts', 'em')()
  File "/opt/pyvenv/em-keyboard/lib64/python3.5/site-packages/pkg_resources/__init__.py", line 547, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/opt/pyvenv/em-keyboard/lib64/python3.5/site-packages/pkg_resources/__init__.py", line 2720, in load_entry_point
    return ep.load()
  File "/opt/pyvenv/em-keyboard/lib64/python3.5/site-packages/pkg_resources/__init__.py", line 2380, in load
    return self.resolve()
  File "/opt/pyvenv/em-keyboard/lib64/python3.5/site-packages/pkg_resources/__init__.py", line 2386, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/opt/pyvenv/em-keyboard/lib64/python3.5/site-packages/em/__init__.py", line 117
    print u'{}  {}'.format(' '.join(v), n)
                  ^
SyntaxError: invalid syntax

Python version:

Python 3.5.1 (default, Jul 10 2016, 20:36:01)
[GCC 6.1.1 20160621 (Red Hat 6.1.1-3)] on linux

Thanks!

Hi @hugovk ,

Just wanted to say thanks for this plugin!
I'm using it via python in my Albert emoji plugin and it's really great! :)

Autocomplete?

I think autocomplete would make this a pretty awesome little package, with functionality similar to GitHub's neat emoji complete feature that pops up when you type a colon โœจ. I'd be willing to do the implementation and open a PR, but it looks to me like the best way to do it would be to use argcomplete, which would require using argparse rather than docopt. How do you feel about sacrificing the readability of the docopt style of argument specification for the convenience of tab completion?

setup fails because HISTORY.rst doesn't exist

At the moment running setup.py fails on a fresh git checkout because HISTORY.rst doesn't exist. here:

long_description=read('README.rst') + '\n\n' + read('HISTORY.rst'),

Creating an empty HISTORY.rst file should fix this.

Unicode Encode Error on Python 2.7 and Windows 7

On Cygwin, looks like a formatting problem:

Annie@soraya /c/Users/Annie/Documents/git/em
$ em family
Traceback (most recent call last):
  File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "c:\python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Python27\Scripts\em.exe\__main__.py", line 9, in <module>
  File "c:\python27\lib\site-packages\em\__init__.py", line 148, in cli
    print(u'Copied! {}'.format(print_results))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 8-9: ordinal not in range(128)

Annie@soraya /c/Users/Annie/Documents/git/em
$ em -s family
Traceback (most recent call last):
  File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "c:\python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Python27\Scripts\em.exe\__main__.py", line 9, in <module>
  File "c:\python27\lib\site-packages\em\__init__.py", line 125, in cli
    print(u'{}  {}'.format(' '.join(v), n))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)

On Windows cmd.exe, looks like the default code page is wrong:

C:\Users\Annie>em -s family
Traceback (most recent call last):
  File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "c:\python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Python27\Scripts\em.exe\__main__.py", line 9, in <module>
  File "c:\python27\lib\site-packages\em\__init__.py", line 125, in cli
    print(u'{}  {}'.format(' '.join(v), n))
  File "c:\python27\lib\encodings\cp437.py", line 12, in encode
    return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-1: cha
racter maps to <undefined>

C:\Users\Annie>em family
Traceback (most recent call last):
  File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "c:\python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Python27\Scripts\em.exe\__main__.py", line 9, in <module>
  File "c:\python27\lib\site-packages\em\__init__.py", line 148, in cli
    print(u'Copied! {}'.format(print_results))
  File "c:\python27\lib\encodings\cp437.py", line 12, in encode
    return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode characters in position 8-9: cha
racter maps to <undefined>

`em -s red` error

OS: OS X 10.11.5
Python: Python 3.5.1 (default, Jun 6 2016, 15:12:24)

when I typed em -s red:

Traceback (most recent call last):
  File "/usr/local/bin/em", line 11, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.5/site-packages/em/__init__.py", line 119, in cli
    found = do_find(lookup, names[0])
  File "/usr/local/lib/python3.5/site-packages/em/__init__.py", line 73, in do_find
    for name, definition in lookup.iteritems():
AttributeError: 'dict' object has no attribute 'iteritems'

QAQ Any suggestion about the error?

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • Update codecov/codecov-action action to v4

Detected dependencies

github-actions
.github/workflows/deploy.yml
  • actions/checkout v4
  • hynek/build-and-inspect-python-package v2
  • actions/download-artifact v4
  • actions/download-artifact v4
.github/workflows/labels.yml
  • actions/checkout v4
  • micnncim/action-label-syncer v1
.github/workflows/lint.yml
  • actions/checkout v4
  • actions/setup-python v5
  • pre-commit/action v3.0.1
.github/workflows/release-drafter.yml
  • release-drafter/release-drafter v6
.github/workflows/require-pr-label.yml
  • mheap/github-action-required-labels v5
.github/workflows/test.yml
  • actions/checkout v4
  • actions/setup-python v5
  • codecov/codecov-action v3.1.5
pep621
pyproject.toml

  • Check this box to trigger a request for Renovate to run again on this repository

Search should be fuzzier

Or keywords for an emoji should include each word in the name separately?

For example, search results for family:

$ em -s family
๐Ÿ‘ช  family

It doesn't return other family ZWJ sequences, such as this in emojis.json:

"family_man_woman_girl": {
    "keywords": ["home", "parents", "people", "human", "child"],
    "char": "๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘ง",
    "category": "people"
},

Version option

I think a -v would be useful, unless it clutters the help page (it looks nice and minimalistic right now).

Optimize search

The search feature is very slow for me (on a nice laptop). Maybe drop the wildcard support for speed, if you think that's a good idea. I know I do not filter emojis by patterns of their names, it may not be an essential feature.

Can't get or search emojis - emojis.json is not found

When I try to get an emoji, or perform a search, I get an error saying emojis.json not found.

elssar@r2d2:~/work/src$ em -s food
Traceback (most recent call last):
  File "/usr/local/bin/em", line 9, in <module>
    load_entry_point('em-keyboard==0.0.3', 'console_scripts', 'em')()
  File "/usr/local/lib/python2.7/dist-packages/em.py", line 105, in cli
    lookup = parse_emojis()
  File "/usr/local/lib/python2.7/dist-packages/em.py", line 41, in parse_emojis
    return json.load(open(filename))
IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/emojis.json'

elssar@r2d2:~/work/src$ em heart
Traceback (most recent call last):
  File "/usr/local/bin/em", line 9, in <module>
    load_entry_point('em-keyboard==0.0.3', 'console_scripts', 'em')()
  File "/usr/local/lib/python2.7/dist-packages/em.py", line 105, in cli
    lookup = parse_emojis()
  File "/usr/local/lib/python2.7/dist-packages/em.py", line 41, in parse_emojis
    return json.load(open(filename))
IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/emojis.json'

Help works fine though.

I'm using Python 2.7.3, pip 1.5.6 on Ubuntu 12.04 (old, I know)

Clipboard support on Windows

Installing this on Windows, it doesn't include by default the dependency needed (xerox) to support the clipboard. To make this worse, xerox has broken dependencies, as it requires pywin32 on Windows, but doesn't declare that dependency.

Ideally, I'd like it if this project depended on pyperclip, which is a 0-dependencies clipboard solution on Windows.

Would a PR to:

  1. Add pyperclip as a dependency on WIndows
  2. Make the code use pyperclip if xerox isn't available

be welcome? I have a PR prepared that implements that, if it would be useful.

Yank release on PyPI

Hi @timofurrer, would you be able to give me the "Owner" role for em-keyboard on PyPI?

I just made a broken release (2.3.0) and whilst I quickly put out a fixed version (2.3.1 via #65), it'd be good if I could "yank" the broken one to prevent anyone ending up with the broken one.

Thanks!

No way to specify em '-1' for :-1:

There is a ๐Ÿ‘Ž emoji:

em -s hand
๐Ÿ–•  middle_finger
โ˜๏ธ  point_up
๐Ÿ’ช  muscle
๐Ÿ‘Š  facepunch
๐Ÿ‘‡  point_down
โœ‹  hand
๐Ÿ‘  +1
๐Ÿค˜  sign_of_horns
๐Ÿ‘Ž  -1

But there doesn't seem to be a way of getting em to print it out (apart from searching for it)

$ em '-1'
Usage:
  em <name>... [--no-copy]
  em -s <name>...

$ em "'-1'"

$ em _1

$ em - -1
Usage:
  em <name>... [--no-copy]
  em -s <name>...

Looking at the cli code, it looks like it's a combination of arguments that begin with '-' being parsed as flags, and also the fact that '-' is translated to '_' when doing lookup.

Using em on Windows

I only opened this issue to keep this as a record here in case anyone needs it.
I am using em-keyboard to copy emojis to the clipboard on windows.
I don't care if they are not displayed correctly in the command prompt, as I am using it from inside a python script using os.system

I was getting an error due to the json file being read without any encoding provided, so I added encoding = 'utf-8' in this line:
json.load(open(filename, encoding='utf-8'))

It is working well now. I can paste the emojis to a text field (I'm using selenium to automate a website operation)

Emoji with spaces in their names do not work

Emoji whose canonical names contain spaces do not appear when queried directly, or when searched for with their exact names:

$ em -s disguised
๐Ÿฅธ  disguised face

$ em -s hugging
๐Ÿค—  hugging_face
๐Ÿซ‚  people hugging

$ em -s transgender
๐Ÿณ๏ธโ€๐ŸŒˆ  rainbow_flag
โšง๏ธ  transgender symbol
๐Ÿณ๏ธโ€โšง๏ธ  transgender flag

$ em 'disguised face'
[1]

$ em 'people hugging'
[1]

$ em 'transgender flag'
[1]

$ em -s 'disguised face'
# no output

$ em -s 'people hugging'
# no output

$ em -s 'transgender flag'
# no output

This seems to be because em currently replaces any spaces, periods, or hyphens in the query text with underscores:

def clean_name(name):
"""Clean emoji name replacing specials chars by underscore"""
special_chars = "[-. ]" # square brackets are part of the regex
return re.sub(special_chars, "_", name)

yet has emoji in its dictionary whose canonical names contain spaces:

em-keyboard/em/emoji-en-US.json

Lines 11885 to 11891 in c1c9afc

"๐Ÿฅธ": [
"disguised face",
"pretent",
"brows",
"glasses",
"moustache"
],

making them impossible to reference directly.

I believe the most straightforward options here are:

  1. Remove all spaces in all emoji names in the dictionary, replacing them with underscores, or
  2. Leave spaces in the query text unmodified.

Of the two, I believe the first option is preferable, as the second would be a departure from the existing behavior of the interface.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.