Update workflow

This commit is contained in:
Chen Asraf
2022-07-20 19:48:24 +03:00
parent f95a52c828
commit c01a68d807
2 changed files with 12 additions and 10 deletions

View File

@@ -6,7 +6,6 @@ import re
import sys
from maps import *
# sys.stdout.write("args: " + str(sys.argv) + "\n")
args = sys.argv[1:]
lang = args[0]
@@ -14,15 +13,20 @@ query = " ".join(args[1:])
heb_icon = "85B31B09-7486-435A-A0A7-2A83BEE74B85.png"
eng_icon = "5EAA025A-A267-432E-9089-0608B2CBE4D3.png"
lang_names = {
"heb": "Hebrew",
"eng": "English",
}
lang_icons = {
"heb": heb_icon,
"eng": eng_icon,
}
def run(lang, query):
res = query.lower()
lang_map = to_heb_map if lang == "heb" else to_eng_map
lang_map = lang_maps[lang]
for k, v in lang_map.items():
res = res.replace(k, v)
return res
@@ -33,10 +37,7 @@ def make_res_item(lang, res):
"title": f"Flipped '{res}' to {lang_names[lang]}",
"subtitle": f"Copy '{res}' to clipboard",
"arg": [res],
"icon": {
# "type": "filetype",
"path": heb_icon if lang == "heb" else eng_icon,
},
"icon": { "path": lang_icons[lang] },
"copy": res,
}
@@ -55,8 +56,4 @@ if re.match(r'[a-z]', query):
out['items'] = out['items'][::-1]
# sys.stdout.write("args: " + str(args) + "\n")
# sys.stdout.write("lang: " + str(lang) + "\n")
# sys.stdout.write("query: " + str(query) + "\n")
sys.stdout.write(json.dumps(out))

View File

@@ -70,3 +70,8 @@ to_eng_map = {
"ץ": ".",
"ת": ",",
}
lang_maps = {
"heb": to_heb_map,
"eng": to_eng_map,
}