-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 10ed8d4
Showing
64 changed files
with
244 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = crlf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.{md,rst,txt}] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 <copyright holders> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Keypirinha Plugin: gitmoji | ||
|
||
This is gitmoji, a plugin for the | ||
[Keypirinha](http://keypirinha.com) launcher. | ||
|
||
Search for [gitmoji](https://github.com/carloscuesta/gitmoji) and copy them to your clipboard. Include them in your commit messages to a better way of identifying the purpose of a commit. | ||
|
||
## Download | ||
|
||
https://github.com/Fuhrmann/keypirinha-gitmoji/releases | ||
|
||
|
||
## Install | ||
|
||
#### Managed | ||
|
||
[@ueffel](https://github.com/ueffel) wrote [PackageControl](https://github.com/ueffel/Keypirinha-PackageControl), a package manager that eases the install of third-party packages. | ||
It must be installed manually. | ||
|
||
#### Manual | ||
|
||
Once the `gitmoji.keypirinha-package` file is installed, | ||
move it to the `InstalledPackage` folder located at: | ||
|
||
* `Keypirinha\portable\Profile\InstalledPackages` in **Portable mode** | ||
* **Or** `%APPDATA%\Keypirinha\InstalledPackages` in **Installed mode** (the | ||
final path would look like | ||
`C:\Users\%USERNAME%\AppData\Roaming\Keypirinha\InstalledPackages`) | ||
|
||
|
||
## Usage | ||
|
||
Open Keypirinha and type 'gitmoji'. Once the suggestion appears press TAB or ENTER to open all suggestions. | ||
|
||
|
||
## Change Log | ||
|
||
### v1.0 | ||
* Released | ||
|
||
## License | ||
|
||
This package is distributed under the terms of the MIT license. | ||
|
||
## Credits | ||
[@carloscuesta](https://github.com/carloscuesta), developer of [gitmoji](https://github.com/carloscuesta/gitmoji) | ||
|
||
[@leolabs](https://github.com/leolabs), developer of [gitmoji for Alfred](https://github.com/leolabs/alfred-gitmoji/) |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
@echo off | ||
setlocal | ||
|
||
set PACKAGE_NAME=Gitmoji | ||
set INSTALL_DIR=%APPDATA%\Keypirinha\InstalledPackages | ||
|
||
if "%1"=="" goto help | ||
if "%1"=="-h" goto help | ||
if "%1"=="--help" goto help | ||
if "%1"=="help" ( | ||
:help | ||
echo Usage: | ||
echo make help | ||
echo make clean | ||
echo make build | ||
echo make install | ||
echo make py [python_args] | ||
goto end | ||
) | ||
|
||
if "%BUILD_DIR%"=="" set BUILD_DIR=%~dp0build | ||
if "%KEYPIRINHA_SDK%"=="" ( | ||
echo ERROR: Keypirinha SDK environment not setup. | ||
echo Run SDK's "kpenv" script and try again. | ||
exit /b 1 | ||
) | ||
|
||
if "%1"=="clean" ( | ||
if exist "%BUILD_DIR%" rmdir /s /q "%BUILD_DIR%" | ||
goto end | ||
) | ||
|
||
if "%1"=="build" ( | ||
if not exist "%BUILD_DIR%" mkdir "%BUILD_DIR%" | ||
pushd "%~dp0" | ||
call "%KEYPIRINHA_SDK%\cmd\kparch" ^ | ||
"%BUILD_DIR%\%PACKAGE_NAME%.keypirinha-package" ^ | ||
-r LICENSE* README* src | ||
popd | ||
goto end | ||
) | ||
|
||
if "%1"=="install" ( | ||
echo TODO: ensure the INSTALL_DIR variable declared at the top of this | ||
echo script complies to your configuration and remove this message | ||
exit /1 | ||
|
||
copy /Y "%BUILD_DIR%\*.keypirinha-package" "%INSTALL_DIR%\" | ||
goto end | ||
) | ||
|
||
if "%1"=="py" ( | ||
call "%KEYPIRINHA_SDK%\cmd\kpy" %2 %3 %4 %5 %6 %7 %8 %9 | ||
goto end | ||
) | ||
|
||
:end |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
# Keypirinha launcher (keypirinha.com) | ||
|
||
import keypirinha as kp | ||
import keypirinha_util as kpu | ||
import keypirinha_net as kpnet | ||
import json | ||
from datetime import datetime | ||
import os.path | ||
|
||
class gitmoji(kp.Plugin): | ||
""" | ||
Search for gitmoji and copy then to your clipboard | ||
This plugin was based on: http://www.packal.org/workflow/gitmoji-0 and http://www.packal.org/workflow/gitmoji | ||
""" | ||
|
||
GITMOJI_URL = "https://raw.githubusercontent.com/carloscuesta/gitmoji/master/src/data/gitmojis.json" | ||
DAYS_KEEP_CACHE = 7 | ||
ITEMCAT = kp.ItemCategory.USER_BASE + 1 | ||
|
||
def __init__(self): | ||
super().__init__() | ||
self.emojis = [] | ||
|
||
def on_start(self): | ||
self.generate_cache() | ||
self.get_gitmoji() | ||
pass | ||
|
||
def on_catalog(self): | ||
self.set_catalog([ | ||
self.create_item( | ||
category=kp.ItemCategory.KEYWORD, | ||
label="gitmoji", | ||
short_desc="Search gitmoji and copy them to your clipboard", | ||
target="gitmoji", | ||
args_hint=kp.ItemArgsHint.REQUIRED, | ||
hit_hint=kp.ItemHitHint.KEEPALL | ||
) | ||
]) | ||
|
||
def on_suggest(self, user_input, items_chain): | ||
if not items_chain or items_chain[0].category() != kp.ItemCategory.KEYWORD: | ||
return | ||
|
||
suggestions = self.filter_emojis(user_input) | ||
self.set_suggestions(suggestions, kp.Match.ANY, kp.Sort.LABEL_ASC) | ||
|
||
def filter_emojis(self, user_input): | ||
return list(filter(lambda item: self.has_title_description(item, user_input), self.emojis)) | ||
|
||
def has_title_description(self, item, user_input): | ||
if user_input.lower() in item.label().lower() or user_input.lower() in item.short_desc().lower(): | ||
return item | ||
|
||
return False | ||
|
||
def on_execute(self, item, action): | ||
kpu.set_clipboard(item.target()) | ||
|
||
def generate_cache(self): | ||
cache_path = self.get_cache_path() | ||
should_generate = False | ||
try: | ||
last_modified = datetime.fromtimestamp(os.path.getmtime(cache_path)).date() | ||
if ((last_modified - datetime.today().date()).days > self.DAYS_KEEP_CACHE): | ||
should_generate = True | ||
except Exception as exc: | ||
should_generate = True | ||
|
||
if not should_generate: | ||
return False | ||
|
||
try: | ||
opener = kpnet.build_urllib_opener() | ||
with opener.open(self.GITMOJI_URL) as request: | ||
response = request.read() | ||
except Exception as exc: | ||
self.err("Could not reach the gitmoji repository file to generate the cache: ", exc) | ||
|
||
data = json.loads(response) | ||
with open(cache_path, "w") as index_file: | ||
json.dump(data, index_file, indent=2) | ||
|
||
def get_gitmoji(self): | ||
if not self.emojis: | ||
with open(self.get_cache_path(), "r") as emojis_file: | ||
data = json.loads(emojis_file.read()) | ||
for item in data['gitmojis']: | ||
suggestion = self.create_item( | ||
category=self.ITEMCAT, | ||
label=item['code'], | ||
short_desc=item['description'], | ||
target=item['code'], | ||
args_hint=kp.ItemArgsHint.FORBIDDEN, | ||
hit_hint=kp.ItemHitHint.IGNORE, | ||
icon_handle=self.load_icon('res://{}/icons/{}.png'.format(self.package_full_name(), item['name'])) | ||
) | ||
|
||
self.emojis.append(suggestion) | ||
|
||
return self.emojis | ||
|
||
def get_cache_path(self): | ||
cache_path = self.get_package_cache_path(True) | ||
return os.path.join(cache_path, 'gitmoji.json') |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.