Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
🏗️ Change to Python for caching and less dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
leolabs committed Feb 17, 2018
1 parent f682dd4 commit 4f0a555
Show file tree
Hide file tree
Showing 9 changed files with 155 additions and 523 deletions.
111 changes: 111 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
.static_storage/
.media/
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

.DS_Store

workflow/
.idea/
Alfred_Workflow-*
Binary file removed C136FFEF-1AF8-41ED-BC4D-27CF2166EA4D.png
Binary file not shown.
16 changes: 2 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,2 @@
# Gitmoji workflow for Alfred
Search for [gitmoji](https://gitmoji.carloscuesta.me/) using
[Alfred](https://www.alfredapp.com/) and copy them to the clipboard easily.

## Installation
You can download the latest version [here](https://github.com/leolabs/alfred-gitmoji/releases/latest).
Just open it in Alfred to install this workflow. No further steps are required.

## Updating the database
This workflow ships with the current version of the gitmoji database, so you can
use it offline, if needed. If you want to update the database, run `gm update`.

## Used libraries
This workflow uses [jq](https://stedolan.github.io/jq/) to process the database.
# alfred-gitmoji
Search for gitmoji using Alfred and copy them to the clipboard easily
35 changes: 35 additions & 0 deletions gitmoji.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/python
# encoding: utf-8

import sys

from workflow import Workflow3, web

gitmoji_db = 'https://raw.githubusercontent.com/carloscuesta/gitmoji/master/src/data/gitmojis.json'


def get_gitmoji_db():
return web.get(gitmoji_db).json()


def main(wf):
data = wf.cached_data('gitmoji_db', get_gitmoji_db, max_age=86400)

for emoji in data['gitmojis']:
wf.add_item(
title=emoji['emoji'] + ' ' + emoji['code'],
subtitle=emoji['description'],
valid=True,
icon='9B7FE8AC-6582-4825-917E-92D0E0291CC1.png',
match=emoji['name'] + ' ' + emoji['description'],
arg=emoji['code'],
copytext=emoji['code'],
largetext=emoji['code']
)

wf.send_feedback()


if __name__ == '__main__':
wf3 = Workflow3()
sys.exit(wf3.run(main))
Loading

0 comments on commit 4f0a555

Please sign in to comment.