From 4cc9d196e5169aa29cfc81470cd08441d80f299c Mon Sep 17 00:00:00 2001 From: Chen Asraf Date: Mon, 11 Jul 2022 02:02:22 +0300 Subject: [PATCH] update flip workflow + use newer python by default --- exports.sh | 2 +- .../heb_flip.py | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/exports.sh b/exports.sh index 646aa9f5..90b34de2 100755 --- a/exports.sh +++ b/exports.sh @@ -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" diff --git a/synced/Alfred.alfredpreferences/workflows/user.workflow.3A312BFD-A5FC-4223-BBFC-400D03F10282/heb_flip.py b/synced/Alfred.alfredpreferences/workflows/user.workflow.3A312BFD-A5FC-4223-BBFC-400D03F10282/heb_flip.py index 134389c4..0e65fa4e 100755 --- a/synced/Alfred.alfredpreferences/workflows/user.workflow.3A312BFD-A5FC-4223-BBFC-400D03F10282/heb_flip.py +++ b/synced/Alfred.alfredpreferences/workflows/user.workflow.3A312BFD-A5FC-4223-BBFC-400D03F10282/heb_flip.py @@ -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")