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

Commit 4f0a555

Browse files
committed
🏗️ Change to Python for caching and less dependencies
1 parent f682dd4 commit 4f0a555

File tree

9 files changed

+155
-523
lines changed

9 files changed

+155
-523
lines changed

.gitignore

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
*.egg-info/
24+
.installed.cfg
25+
*.egg
26+
MANIFEST
27+
28+
# PyInstaller
29+
# Usually these files are written by a python script from a template
30+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
31+
*.manifest
32+
*.spec
33+
34+
# Installer logs
35+
pip-log.txt
36+
pip-delete-this-directory.txt
37+
38+
# Unit test / coverage reports
39+
htmlcov/
40+
.tox/
41+
.coverage
42+
.coverage.*
43+
.cache
44+
nosetests.xml
45+
coverage.xml
46+
*.cover
47+
.hypothesis/
48+
.pytest_cache/
49+
50+
# Translations
51+
*.mo
52+
*.pot
53+
54+
# Django stuff:
55+
*.log
56+
.static_storage/
57+
.media/
58+
local_settings.py
59+
60+
# Flask stuff:
61+
instance/
62+
.webassets-cache
63+
64+
# Scrapy stuff:
65+
.scrapy
66+
67+
# Sphinx documentation
68+
docs/_build/
69+
70+
# PyBuilder
71+
target/
72+
73+
# Jupyter Notebook
74+
.ipynb_checkpoints
75+
76+
# pyenv
77+
.python-version
78+
79+
# celery beat schedule file
80+
celerybeat-schedule
81+
82+
# SageMath parsed files
83+
*.sage.py
84+
85+
# Environments
86+
.env
87+
.venv
88+
env/
89+
venv/
90+
ENV/
91+
env.bak/
92+
venv.bak/
93+
94+
# Spyder project settings
95+
.spyderproject
96+
.spyproject
97+
98+
# Rope project settings
99+
.ropeproject
100+
101+
# mkdocs documentation
102+
/site
103+
104+
# mypy
105+
.mypy_cache/
106+
107+
.DS_Store
108+
109+
workflow/
110+
.idea/
111+
Alfred_Workflow-*
-11.1 KB
Binary file not shown.

README.md

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,2 @@
1-
# Gitmoji workflow for Alfred
2-
Search for [gitmoji](https://gitmoji.carloscuesta.me/) using
3-
[Alfred](https://www.alfredapp.com/) and copy them to the clipboard easily.
4-
5-
## Installation
6-
You can download the latest version [here](https://github.com/leolabs/alfred-gitmoji/releases/latest).
7-
Just open it in Alfred to install this workflow. No further steps are required.
8-
9-
## Updating the database
10-
This workflow ships with the current version of the gitmoji database, so you can
11-
use it offline, if needed. If you want to update the database, run `gm update`.
12-
13-
## Used libraries
14-
This workflow uses [jq](https://stedolan.github.io/jq/) to process the database.
1+
# alfred-gitmoji
2+
Search for gitmoji using Alfred and copy them to the clipboard easily

gitmoji.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/python
2+
# encoding: utf-8
3+
4+
import sys
5+
6+
from workflow import Workflow3, web
7+
8+
gitmoji_db = 'https://raw.githubusercontent.com/carloscuesta/gitmoji/master/src/data/gitmojis.json'
9+
10+
11+
def get_gitmoji_db():
12+
return web.get(gitmoji_db).json()
13+
14+
15+
def main(wf):
16+
data = wf.cached_data('gitmoji_db', get_gitmoji_db, max_age=86400)
17+
18+
for emoji in data['gitmojis']:
19+
wf.add_item(
20+
title=emoji['emoji'] + ' ' + emoji['code'],
21+
subtitle=emoji['description'],
22+
valid=True,
23+
icon='9B7FE8AC-6582-4825-917E-92D0E0291CC1.png',
24+
match=emoji['name'] + ' ' + emoji['description'],
25+
arg=emoji['code'],
26+
copytext=emoji['code'],
27+
largetext=emoji['code']
28+
)
29+
30+
wf.send_feedback()
31+
32+
33+
if __name__ == '__main__':
34+
wf3 = Workflow3()
35+
sys.exit(wf3.run(main))

0 commit comments

Comments
 (0)