Skip to content

Commit

Permalink
Alfred 5.1 multiple keywords feature support
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesHopbourn authored Nov 23, 2023
1 parent 758804f commit 9207fc5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 75 deletions.
79 changes: 6 additions & 73 deletions info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,10 @@
<dict>
<key>bundleid</key>
<string>com.hopbourn.leetcode-search</string>
<key>category</key>
<string>Productivity</string>
<key>connections</key>
<dict>
<key>150D093F-8D15-4EDB-A55E-B4862A5D7E40</key>
<array>
<dict>
<key>destinationuid</key>
<string>89066D90-11BF-40C9-BD1C-A7585FAAA4C2</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
<key>3B4CA1A5-E71B-4073-9282-BFA5E25D49D6</key>
<array>
<dict>
Expand Down Expand Up @@ -59,7 +48,7 @@
<key>escaping</key>
<integer>102</integer>
<key>keyword</key>
<string>lc</string>
<string>lc||sxl</string>
<key>queuedelaycustom</key>
<integer>3</integer>
<key>queuedelayimmediatelyinitially</key>
Expand All @@ -71,7 +60,7 @@
<key>runningsubtext</key>
<string>查询中,请等待......</string>
<key>script</key>
<string>python3 leetcode.py "$1" ""</string>
<string>python3 leetcode.py "$1"</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
Expand Down Expand Up @@ -113,73 +102,17 @@
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>alfredfiltersresults</key>
<false/>
<key>alfredfiltersresultsmatchmode</key>
<integer>0</integer>
<key>argumenttreatemptyqueryasnil</key>
<true/>
<key>argumenttrimmode</key>
<integer>0</integer>
<key>argumenttype</key>
<integer>1</integer>
<key>escaping</key>
<integer>102</integer>
<key>keyword</key>
<string>sxl</string>
<key>queuedelaycustom</key>
<integer>3</integer>
<key>queuedelayimmediatelyinitially</key>
<true/>
<key>queuedelaymode</key>
<integer>0</integer>
<key>queuemode</key>
<integer>1</integer>
<key>runningsubtext</key>
<string>查询中,请等待......</string>
<key>script</key>
<string>python3 leetcode.py "$1" "sxl"</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
<string></string>
<key>subtext</key>
<string></string>
<key>title</key>
<string>搜索 Leetcode 题目</string>
<key>type</key>
<integer>11</integer>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>150D093F-8D15-4EDB-A55E-B4862A5D7E40</string>
<key>version</key>
<integer>3</integer>
</dict>
</array>
<key>readme</key>
<string></string>
<key>uidata</key>
<dict>
<key>150D093F-8D15-4EDB-A55E-B4862A5D7E40</key>
<dict>
<key>xpos</key>
<real>275</real>
<key>ypos</key>
<real>260</real>
</dict>
<key>3B4CA1A5-E71B-4073-9282-BFA5E25D49D6</key>
<dict>
<key>xpos</key>
<real>275</real>
<real>280</real>
<key>ypos</key>
<real>135</real>
<real>200</real>
</dict>
<key>89066D90-11BF-40C9-BD1C-A7585FAAA4C2</key>
<dict>
Expand Down
5 changes: 3 additions & 2 deletions leetcode.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import re
import sys
import json
Expand All @@ -11,11 +12,11 @@ def camel_to_snake(camel_case_string):
result = []
for item in data:
# ValidAnagram
if sys.argv[1].isalpha() and camel_to_snake(sys.argv[1]) == item["arg"]:
if sys.argv[1].isalpha() and camel_to_snake(sys.argv[1]) in item["arg"]:
pass
elif sys.argv[1].lower() not in item["title"].lower():
continue
if sys.argv[2].lower() == "":
if os.environ['alfred_workflow_keyword'].lower() == "lc":
item["arg"] = f"https://leetcode.cn/problems/{item['arg']}/description/"
else:
item["arg"] = f"https://www.google.com.hk/search?&q=site:programmercarl.com+{item['title']}"
Expand Down

0 comments on commit 9207fc5

Please sign in to comment.