Emoji command line helper 👾

I recently played a bit with emojis, the result is this script which lets me search existing emojis and transform strings. It's a trivial Python script that leverages https://github.com/carpedm20/emoji
#!/usr/bin/env python
"""
Emoji search and translate CLI tool
Uses the emoji lib https://pypi.org/project/emoji/, https://github.com/carpedm20/emoji
"""
import argparse
import emoji
parser = argparse.ArgumentParser(description="Emoji helper")
parser.add_argument("search", type=str, nargs="*")
parser.add_argument("--emojify", "-e", type=str)
parser.add_argument("--dump", action="store_true")
parser.add_argument("--find", "-f", type=str)
args = parser.parse_args()
if args.search:
for key, value in emoji.unicode_codes.EMOJI_DATA.items():
if any(word in key for word in args.search):
print(f"{value}\t{key}")
elif args.emojify:
print(emoji.emojize(args.emojify))
elif args.dump:
for key, value in emoji.unicode_codes.EMOJI_DATA.items():
print(f"{value}\t{key}")
elif args.find:
for key, value in emoji.unicode_codes.EMOJI_DATA.items():
if args.find in value:
print(f"{value}\t{key}")
else:
parser.print_help()
0 comments
Reply