Skip to content

Commit 7f6d538

Browse files
committed
v1.0.1
1 parent d439a2c commit 7f6d538

File tree

1 file changed

+149
-35
lines changed

1 file changed

+149
-35
lines changed

src/info.plist

Lines changed: 149 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,32 @@
88
<string>Productivity</string>
99
<key>connections</key>
1010
<dict>
11+
<key>50E582F7-76D0-487C-80FE-A5263B8395E1</key>
12+
<array>
13+
<dict>
14+
<key>destinationuid</key>
15+
<string>FD03FD75-DCFF-4A61-AC2A-68B249B93373</string>
16+
<key>modifiers</key>
17+
<integer>0</integer>
18+
<key>modifiersubtext</key>
19+
<string></string>
20+
<key>vitoclose</key>
21+
<false/>
22+
</dict>
23+
</array>
24+
<key>54615906-5E31-43E3-AAC0-E6A0FDF80272</key>
25+
<array>
26+
<dict>
27+
<key>destinationuid</key>
28+
<string>FD03FD75-DCFF-4A61-AC2A-68B249B93373</string>
29+
<key>modifiers</key>
30+
<integer>0</integer>
31+
<key>modifiersubtext</key>
32+
<string></string>
33+
<key>vitoclose</key>
34+
<false/>
35+
</dict>
36+
</array>
1137
<key>8987AD20-8E78-4106-9212-B84CB6537B08</key>
1238
<array>
1339
<dict>
@@ -20,12 +46,22 @@
2046
<key>vitoclose</key>
2147
<false/>
2248
</dict>
49+
<dict>
50+
<key>destinationuid</key>
51+
<string>50E582F7-76D0-487C-80FE-A5263B8395E1</string>
52+
<key>modifiers</key>
53+
<integer>1048576</integer>
54+
<key>modifiersubtext</key>
55+
<string></string>
56+
<key>vitoclose</key>
57+
<false/>
58+
</dict>
2359
</array>
2460
</dict>
2561
<key>createdby</key>
2662
<string>Albert Cai</string>
2763
<key>description</key>
28-
<string>Search all of your personal, starred, and organization's repos.</string>
64+
<string>Search all of your personal, starred, and organization's repos</string>
2965
<key>disabled</key>
3066
<false/>
3167
<key>name</key>
@@ -36,15 +72,15 @@
3672
<key>config</key>
3773
<dict>
3874
<key>alfredfiltersresults</key>
39-
<false/>
75+
<true/>
4076
<key>alfredfiltersresultsmatchmode</key>
41-
<integer>0</integer>
77+
<integer>3</integer>
4278
<key>argumenttreatemptyqueryasnil</key>
4379
<true/>
4480
<key>argumenttrimmode</key>
4581
<integer>0</integer>
4682
<key>argumenttype</key>
47-
<integer>0</integer>
83+
<integer>1</integer>
4884
<key>escaping</key>
4985
<integer>102</integer>
5086
<key>keyword</key>
@@ -62,15 +98,10 @@
6298
<key>script</key>
6399
<string>#!/bin/bash
64100
65-
# Fetch GitHub username and token from workflow environment variables
101+
# Fetch workflow configuration variables
66102
GITHUB_USERNAME="$username"
67103
GITHUB_TOKEN="$token"
68-
69-
# Ensure that the token and username are set
70-
if [ -z "$GITHUB_USERNAME" ] || [ -z "$GITHUB_TOKEN" ]; then
71-
echo "Please set your GitHub username and token in the workflow configuration."
72-
exit 1
73-
fi
104+
CACHE_DURATION="$cacheDuration"
74105
75106
# Search query from Alfred input
76107
QUERY="$1"
@@ -102,29 +133,36 @@ ALL_REPOS=$(echo -e "$USER_REPOS\n$STARRED_REPOS\n$ORG_REPOS" | sort -u)
102133
# Filter results based on query
103134
FILTERED_REPOS=$(echo "$ALL_REPOS" | grep -i "$QUERY")
104135
105-
# Generate Alfred Script Filter XML output
106-
echo "&lt;?xml version='1.0'?&gt;"
107-
echo "&lt;items&gt;"
136+
# Generate Alfred JSON output
137+
echo "{
138+
\"cache\": {
139+
\"seconds\": $CACHE_DURATION
140+
},
141+
\"items\":["
108142
109-
# Check if there are any filtered results
110-
if [ -z "$FILTERED_REPOS" ]; then
111-
echo "&lt;item&gt;"
112-
echo "&lt;title&gt;🚫 No results&lt;/title&gt;"
113-
echo "&lt;subtitle&gt;No results found for '$QUERY'&lt;/subtitle&gt;"
114-
echo "&lt;valid&gt;false&lt;/valid&gt;"
115-
echo "&lt;/item&gt;"
116-
else
117-
while IFS= read -r REPO; do
118-
if [ -n "$REPO" ]; then
119-
echo "&lt;item arg=\"https://github.com/$REPO\"&gt;"
120-
echo "&lt;title&gt;$REPO&lt;/title&gt;"
121-
echo "&lt;subtitle&gt;Open in GitHub&lt;/subtitle&gt;"
122-
echo "&lt;/item&gt;"
143+
first_item=true
144+
while IFS= read -r REPO; do
145+
if [ -n "$REPO" ]; then
146+
if [ "$first_item" = true ]; then
147+
first_item=false
148+
else
149+
echo ","
123150
fi
124-
done &lt;&lt;&lt; "$FILTERED_REPOS"
125-
fi
151+
echo "{
152+
\"title\": \"$REPO\",
153+
\"subtitle\": \"Open in GitHub\",
154+
\"arg\": \"https://github.com/$REPO\",
155+
\"mods\": {
156+
\"cmd\": {
157+
\"subtitle\": \"⌘: Copy URL to clipboard\",
158+
\"arg\": \"https://github.com/$REPO\"
159+
}
160+
}
161+
}"
162+
fi
163+
done &lt;&lt;&lt; "$FILTERED_REPOS"
126164
127-
echo "&lt;/items&gt;"</string>
165+
echo "]}"</string>
128166
<key>scriptargtype</key>
129167
<integer>1</integer>
130168
<key>scriptfile</key>
@@ -166,13 +204,46 @@ echo "&lt;/items&gt;"</string>
166204
<key>version</key>
167205
<integer>1</integer>
168206
</dict>
207+
<dict>
208+
<key>config</key>
209+
<dict>
210+
<key>unstackview</key>
211+
<false/>
212+
</dict>
213+
<key>type</key>
214+
<string>alfred.workflow.utility.hidealfred</string>
215+
<key>uid</key>
216+
<string>FD03FD75-DCFF-4A61-AC2A-68B249B93373</string>
217+
<key>version</key>
218+
<integer>1</integer>
219+
</dict>
220+
<dict>
221+
<key>config</key>
222+
<dict>
223+
<key>autopaste</key>
224+
<false/>
225+
<key>clipboardtext</key>
226+
<string>{query}</string>
227+
<key>ignoredynamicplaceholders</key>
228+
<false/>
229+
<key>transient</key>
230+
<false/>
231+
</dict>
232+
<key>type</key>
233+
<string>alfred.workflow.output.clipboard</string>
234+
<key>uid</key>
235+
<string>50E582F7-76D0-487C-80FE-A5263B8395E1</string>
236+
<key>version</key>
237+
<integer>3</integer>
238+
</dict>
169239
</array>
170240
<key>readme</key>
171241
<string># My Github Search - An Alfred Workflow
172242
Search all of your personal, starred, and organization repos in [Alfred](https://www.alfredapp.com/), a powerful MacOS launcher application. It uses the [GitHub REST API Endpoints](https://docs.github.com/en/rest/repos?apiVersion=2022-11-28).
173243
174244
## Dependencies
175245
Alfred 5 with [PowerPack](https://www.alfredapp.com/powerpack/).
246+
Also, need `jq`, see install at [their docs](https://jqlang.github.io/jq/download/).
176247
Nothing else, everything is in a single bash script :)
177248
178249
## Usage
@@ -190,20 +261,38 @@ Note that I personally use a classic token so I can have no expiration date.
190261
You can also customize the `ghs` command to any command of your choice in the same pane.</string>
191262
<key>uidata</key>
192263
<dict>
264+
<key>50E582F7-76D0-487C-80FE-A5263B8395E1</key>
265+
<dict>
266+
<key>colorindex</key>
267+
<integer>2</integer>
268+
<key>xpos</key>
269+
<real>535</real>
270+
<key>ypos</key>
271+
<real>390</real>
272+
</dict>
193273
<key>54615906-5E31-43E3-AAC0-E6A0FDF80272</key>
194274
<dict>
195275
<key>xpos</key>
196-
<real>400</real>
276+
<real>530</real>
197277
<key>ypos</key>
198-
<real>265</real>
278+
<real>270</real>
199279
</dict>
200280
<key>8987AD20-8E78-4106-9212-B84CB6537B08</key>
201281
<dict>
202282
<key>xpos</key>
203-
<real>200</real>
283+
<real>195</real>
204284
<key>ypos</key>
205285
<real>260</real>
206286
</dict>
287+
<key>FD03FD75-DCFF-4A61-AC2A-68B249B93373</key>
288+
<dict>
289+
<key>colorindex</key>
290+
<integer>12</integer>
291+
<key>xpos</key>
292+
<real>755</real>
293+
<key>ypos</key>
294+
<real>320</real>
295+
</dict>
207296
</dict>
208297
<key>userconfigurationconfig</key>
209298
<array>
@@ -228,6 +317,31 @@ You can also customize the `ghs` command to any command of your choice in the sa
228317
<key>variable</key>
229318
<string>fullsearch</string>
230319
</dict>
320+
<dict>
321+
<key>config</key>
322+
<dict>
323+
<key>defaultvalue</key>
324+
<integer>10</integer>
325+
<key>markercount</key>
326+
<integer>12</integer>
327+
<key>maxvalue</key>
328+
<integer>86400</integer>
329+
<key>minvalue</key>
330+
<integer>0</integer>
331+
<key>onlystoponmarkers</key>
332+
<false/>
333+
<key>showmarkers</key>
334+
<true/>
335+
</dict>
336+
<key>description</key>
337+
<string>The workflow will run faster but update to new repos slower.</string>
338+
<key>label</key>
339+
<string>Cache Duration (seconds)</string>
340+
<key>type</key>
341+
<string>slider</string>
342+
<key>variable</key>
343+
<string>cacheDuration</string>
344+
</dict>
231345
<dict>
232346
<key>config</key>
233347
<dict>
@@ -274,7 +388,7 @@ You can also customize the `ghs` command to any command of your choice in the sa
274388
<key>variablesdontexport</key>
275389
<array/>
276390
<key>version</key>
277-
<string>1.0.0</string>
391+
<string>1.0.1</string>
278392
<key>webaddress</key>
279393
<string>https://github.com/albertcai101/alfred-my-github-search-workflow</string>
280394
</dict>

0 commit comments

Comments
 (0)