update flip workflow + use newer python by default

This commit is contained in:
Chen Asraf
2022-07-11 02:02:22 +03:00
parent 8bc1c397f1
commit 4cc9d196e5
2 changed files with 12 additions and 4 deletions

View File

@@ -24,7 +24,7 @@ export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
export PATH="$HOME/.flutter-src/bin:$PATH"
export PATH="$HOME/.flutter-src/bin/cache/dart-sdk/bin:$PATH"
export PATH="$HOME/.pub-cache/bin:$PATH"
export PATH="$HOME/Library/Python/3.9/bin:$PATH"
export PATH="$HOME/Library/Python/3.10/bin:$PATH"
export PATH="$HOME/.gem/ruby/3.0.0/bin:$PATH"
export PATH="$HOME/.gem/ruby/3.1.0/bin:$PATH"
export PATH="/opt/homebrew/opt/ruby/bin:$PATH"

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env python
import json
import re
# -*- coding: utf-8 -*-
import sys
@@ -13,6 +14,10 @@ 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",
}
def run(lang, query):
@@ -25,8 +30,8 @@ def run(lang, query):
def make_res_item(lang, res):
return {
"title": f"Copy {res}",
"subtitle": f"Copy {res} to clipboard",
"title": f"Flipped '{res}' to {lang_names[lang]}",
"subtitle": f"Copy '{res}' to clipboard",
"arg": [res],
"icon": {
# "type": "filetype",
@@ -39,13 +44,16 @@ def make_res_item(lang, res):
out = {"items": []}
if lang != "":
out['items'] = [make_res_item(run(lang, query))]
out['items'] = [make_res_item(lang, run(lang, query))]
else:
out['items'] = [
make_res_item("eng", run("eng", query)),
make_res_item("heb", run("heb", query)),
]
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")