Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 409f1cf

Browse filesBrowse files
committed
Add Alfred project.
1 parent 728b588 commit 409f1cf
Copy full SHA for 409f1cf

4 files changed

+263Lines changed: 263 additions & 0 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎icon.png‎

Copy file name to clipboard
19.8 KB
  • Display the source diff
  • Display the rich diff
Loading
Collapse file

‎index.js‎

Copy file name to clipboard
+63Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
var alfy = require('alfy');
2+
function isSreachIndexOF(oldstr,kw){
3+
var istrue = false;
4+
if(oldstr&&toString.call(oldstr) === '[object Array]'){
5+
for (var i = 0; i < oldstr.length; i++) {
6+
oldstr[i].toLowerCase()===kw.toLowerCase()?istrue=true:null;
7+
}
8+
return istrue;
9+
}
10+
if(!oldstr || !kw) return false;
11+
return oldstr.toLowerCase().indexOf(kw.toLowerCase()) > -1 ? true : false;
12+
}
13+
14+
var urlstr = 'git.oschina.net/JSLite/linux-command/raw/master/dist/data.json'
15+
// var urlstr = 'http://git.oschina.net/JSLite/linux-command/raw/master/dist/data.json'
16+
17+
alfy.fetch(urlstr).then(result => {
18+
var commands = [];
19+
var e = 0
20+
for(var a in result){
21+
++e;
22+
result[a]['id'] = e;
23+
commands.push(result[a])
24+
}
25+
var i=0,
26+
page_size = commands.length,
27+
arrResult = [],
28+
query=alfy.input;
29+
if(commands&&commands.length&&toString.call(commands).indexOf('Array')>-1){
30+
var count = 0
31+
for (; i < page_size; i++) {
32+
if(isSreachIndexOF(commands[i].n,query)
33+
|| isSreachIndexOF(commands[i].d,query)
34+
){
35+
if(count < page_size){
36+
arrResult.push(commands[i]);
37+
++count;
38+
}
39+
}
40+
}
41+
}
42+
var items = [];
43+
for(var i = 0;i< arrResult.length;i++){
44+
items.push({
45+
title: arrResult[i].n,
46+
subtitle: arrResult[i].d,
47+
arg: arrResult[i].n
48+
})
49+
}
50+
51+
if(items.length < 1){
52+
items.push({
53+
title: "没有搜素到内容",
54+
subtitle: "请尝试其它关键字",
55+
})
56+
}
57+
alfy.output(items);
58+
});
59+
// const items = alfy.inputMatches(commands, 'n').map(x => ({
60+
// title: x.n,
61+
// subtitle: x.d,
62+
// arg: x.id
63+
// }));
Collapse file

‎info.plist‎

Copy file name to clipboard
+163Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>bundleid</key>
6+
<string>com.linux.command.keywords</string>
7+
<key>category</key>
8+
<string>Tools</string>
9+
<key>connections</key>
10+
<dict>
11+
<key>AB769D13-5DB9-42BF-A314-2D07384CB3A4</key>
12+
<array>
13+
<dict>
14+
<key>destinationuid</key>
15+
<string>0E764AF0-9350-40B4-8A01-175FAD0D952D</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>C24D6FD9-17A8-47C0-B2FD-7F1323E47407</key>
25+
<array>
26+
<dict>
27+
<key>destinationuid</key>
28+
<string>AB769D13-5DB9-42BF-A314-2D07384CB3A4</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>
37+
</dict>
38+
<key>createdby</key>
39+
<string>kenny wang</string>
40+
<key>description</key>
41+
<string>520多个 Linux 命令大全,内容包含 Linux 命令手册、详解、学习,值得收藏的 Linux 命令速查手册。</string>
42+
<key>disabled</key>
43+
<false/>
44+
<key>name</key>
45+
<string>Linux Command</string>
46+
<key>objects</key>
47+
<array>
48+
<dict>
49+
<key>config</key>
50+
<dict>
51+
<key>browser</key>
52+
<string></string>
53+
<key>spaces</key>
54+
<string></string>
55+
<key>url</key>
56+
<string>https://jaywcjlove.github.io/linux-command/c/{query}.html</string>
57+
<key>utf8</key>
58+
<true/>
59+
</dict>
60+
<key>type</key>
61+
<string>alfred.workflow.action.openurl</string>
62+
<key>uid</key>
63+
<string>0E764AF0-9350-40B4-8A01-175FAD0D952D</string>
64+
<key>version</key>
65+
<integer>1</integer>
66+
</dict>
67+
<dict>
68+
<key>config</key>
69+
<dict>
70+
<key>autopaste</key>
71+
<true/>
72+
<key>clipboardtext</key>
73+
<string>{query}</string>
74+
<key>transient</key>
75+
<false/>
76+
</dict>
77+
<key>type</key>
78+
<string>alfred.workflow.output.clipboard</string>
79+
<key>uid</key>
80+
<string>AB769D13-5DB9-42BF-A314-2D07384CB3A4</string>
81+
<key>version</key>
82+
<integer>2</integer>
83+
</dict>
84+
<dict>
85+
<key>config</key>
86+
<dict>
87+
<key>alfredfiltersresults</key>
88+
<false/>
89+
<key>argumenttype</key>
90+
<integer>0</integer>
91+
<key>escaping</key>
92+
<integer>36</integer>
93+
<key>keyword</key>
94+
<string>lc</string>
95+
<key>queuedelaycustom</key>
96+
<integer>3</integer>
97+
<key>queuedelayimmediatelyinitially</key>
98+
<true/>
99+
<key>queuedelaymode</key>
100+
<integer>0</integer>
101+
<key>queuemode</key>
102+
<integer>1</integer>
103+
<key>runningsubtext</key>
104+
<string>正在搜索中...</string>
105+
<key>script</key>
106+
<string>./node_modules/.bin/run-node index.js {query}</string>
107+
<key>scriptargtype</key>
108+
<integer>0</integer>
109+
<key>scriptfile</key>
110+
<string></string>
111+
<key>subtext</key>
112+
<string>搜索Linux命令</string>
113+
<key>title</key>
114+
<string>命令行搜索工具</string>
115+
<key>type</key>
116+
<integer>0</integer>
117+
<key>withspace</key>
118+
<true/>
119+
</dict>
120+
<key>type</key>
121+
<string>alfred.workflow.input.scriptfilter</string>
122+
<key>uid</key>
123+
<string>C24D6FD9-17A8-47C0-B2FD-7F1323E47407</string>
124+
<key>version</key>
125+
<integer>2</integer>
126+
</dict>
127+
</array>
128+
<key>readme</key>
129+
<string>Linux命令大全搜索工具,内容包含Linux命令手册、详解、学习、搜集。</string>
130+
<key>uidata</key>
131+
<dict>
132+
<key>0E764AF0-9350-40B4-8A01-175FAD0D952D</key>
133+
<dict>
134+
<key>xpos</key>
135+
<integer>390</integer>
136+
<key>ypos</key>
137+
<integer>70</integer>
138+
</dict>
139+
<key>AB769D13-5DB9-42BF-A314-2D07384CB3A4</key>
140+
<dict>
141+
<key>xpos</key>
142+
<integer>240</integer>
143+
<key>ypos</key>
144+
<integer>70</integer>
145+
</dict>
146+
<key>C24D6FD9-17A8-47C0-B2FD-7F1323E47407</key>
147+
<dict>
148+
<key>colorindex</key>
149+
<integer>8</integer>
150+
<key>note</key>
151+
<string>Script Filter Input: A very powerful workflow object, allowing you to populate Alfred's results with your own custom items using external input.</string>
152+
<key>xpos</key>
153+
<integer>70</integer>
154+
<key>ypos</key>
155+
<integer>70</integer>
156+
</dict>
157+
</dict>
158+
<key>version</key>
159+
<string>1.0</string>
160+
<key>webaddress</key>
161+
<string>https://git.io/linux</string>
162+
</dict>
163+
</plist>
Collapse file

‎package.json‎

Copy file name to clipboard
+37Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"name": "alfred-linux-command",
3+
"version": "1.0.0",
4+
"description": "Search through the Linux command.",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1",
8+
"postinstall": "alfy-init",
9+
"preuninstall": "alfy-cleanup"
10+
},
11+
"keywords": [
12+
"linux",
13+
"command",
14+
"alfred",
15+
"workflow",
16+
"mdn",
17+
"mozilla",
18+
"developers",
19+
"network",
20+
"html",
21+
"javascript",
22+
"js"
23+
],
24+
"files": [
25+
"index.js",
26+
"icon.png",
27+
"info.plist"
28+
],
29+
"engines": {
30+
"node": ">=4"
31+
},
32+
"author": "kenny wang <wowohoo@qq.com>",
33+
"license": "MIT",
34+
"dependencies": {
35+
"alfy": "^0.6.0"
36+
}
37+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.