✨ added support to list all gitmojis
This commit is contained in:
parent
4ed2d152f8
commit
16f38ce21b
16
__init__.py
16
__init__.py
@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
"""gitmoji Picker for Albert
|
"""gitmoji Picker for Albert
|
||||||
Usage: g: gitmoji name or description
|
Usage: g: gitmoji name or description
|
||||||
Example: g: bug"""
|
Examples:
|
||||||
|
g:bug
|
||||||
|
g:*"""
|
||||||
|
|
||||||
from albertv0 import *
|
from albertv0 import *
|
||||||
|
|
||||||
@ -31,6 +33,12 @@ def initialize():
|
|||||||
gitmojis.append(gitmoji)
|
gitmojis.append(gitmoji)
|
||||||
|
|
||||||
def handleQuery(query):
|
def handleQuery(query):
|
||||||
|
if not query.isValid or not query.isTriggered:
|
||||||
|
return []
|
||||||
|
|
||||||
|
if query.string == "*":
|
||||||
|
matches = gitmojis
|
||||||
|
else:
|
||||||
needles = query.string.lower().split()
|
needles = query.string.lower().split()
|
||||||
|
|
||||||
matches = []
|
matches = []
|
||||||
@ -42,10 +50,14 @@ def handleQuery(query):
|
|||||||
result["matchCount"] = matchCount
|
result["matchCount"] = matchCount
|
||||||
matches.append(result)
|
matches.append(result)
|
||||||
|
|
||||||
|
if not query.isValid:
|
||||||
|
return []
|
||||||
|
|
||||||
matches = sorted(matches, key=lambda data: data["matchCount"], reverse=True)
|
matches = sorted(matches, key=lambda data: data["matchCount"], reverse=True)
|
||||||
|
|
||||||
if query.isValid and query.isTriggered:
|
if query.isValid:
|
||||||
return [Item(id=match["name"], completion=match["name"], icon=match["emoji"], text=match["emoji"] + " " + match["code"], subtext=match["description"], actions=[ClipAction("Copy to clipboard", match["code"])]) for match in matches]
|
return [Item(id=match["name"], completion=match["name"], icon=match["emoji"], text=match["emoji"] + " " + match["code"], subtext=match["description"], actions=[ClipAction("Copy to clipboard", match["code"])]) for match in matches]
|
||||||
|
else:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def count_matches(tokens, needles):
|
def count_matches(tokens, needles):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user