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 80c5e18

Browse filesBrowse files
committed
修复搜索反馈慢的问题.
1 parent 4e03832 commit 80c5e18
Copy full SHA for 80c5e18

5 files changed

+60-91Lines changed: 60 additions & 91 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

‎data.json‎

Copy file name to clipboardExpand all lines: data.json
+1Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.
Collapse file

‎index.js‎

Copy file name to clipboardExpand all lines: index.js
-63Lines changed: 0 additions & 63 deletions
This file was deleted.
Collapse file

‎info.plist‎

Copy file name to clipboardExpand all lines: info.plist
+25-23Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
<dict>
55
<key>bundleid</key>
66
<string>com.linux.command.keywords</string>
7-
<key>category</key>
8-
<string>Tools</string>
97
<key>connections</key>
108
<dict>
119
<key>AB769D13-5DB9-42BF-A314-2D07384CB3A4</key>
@@ -45,25 +43,6 @@
4543
<string>Linux Command</string>
4644
<key>objects</key>
4745
<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>
6746
<dict>
6847
<key>config</key>
6948
<dict>
@@ -86,10 +65,12 @@
8665
<dict>
8766
<key>alfredfiltersresults</key>
8867
<false/>
68+
<key>argumenttrimmode</key>
69+
<integer>0</integer>
8970
<key>argumenttype</key>
9071
<integer>0</integer>
9172
<key>escaping</key>
92-
<integer>36</integer>
73+
<integer>62</integer>
9374
<key>keyword</key>
9475
<string>lc</string>
9576
<key>queuedelaycustom</key>
@@ -103,7 +84,9 @@
10384
<key>runningsubtext</key>
10485
<string>正在搜索中...</string>
10586
<key>script</key>
106-
<string>./node_modules/.bin/run-node index.js {query}</string>
87+
<string>/usr/local/bin/node &lt;&lt;-'CODE'
88+
require("./linux")("{query}");
89+
CODE</string>
10790
<key>scriptargtype</key>
10891
<integer>0</integer>
10992
<key>scriptfile</key>
@@ -124,6 +107,25 @@
124107
<key>version</key>
125108
<integer>2</integer>
126109
</dict>
110+
<dict>
111+
<key>config</key>
112+
<dict>
113+
<key>browser</key>
114+
<string></string>
115+
<key>spaces</key>
116+
<string></string>
117+
<key>url</key>
118+
<string>https://jaywcjlove.github.io/linux-command/c/{query}.html</string>
119+
<key>utf8</key>
120+
<true/>
121+
</dict>
122+
<key>type</key>
123+
<string>alfred.workflow.action.openurl</string>
124+
<key>uid</key>
125+
<string>0E764AF0-9350-40B4-8A01-175FAD0D952D</string>
126+
<key>version</key>
127+
<integer>1</integer>
128+
</dict>
127129
</array>
128130
<key>readme</key>
129131
<string>Linux命令大全搜索工具,内容包含Linux命令手册、详解、学习、搜集。</string>
Collapse file

‎linux.js‎

Copy file name to clipboard
+32Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
const data = require('./data.json');
3+
4+
module.exports = function (query) {
5+
var commands = [];
6+
Object.keys(data).forEach(function (keyName) {
7+
if (keyName.toLowerCase().indexOf(query) > -1) {
8+
const cmd = data[keyName];
9+
commands.push({
10+
title: cmd.n,
11+
subtitle: cmd.d,
12+
});
13+
}
14+
});
15+
commands = commands.map(function (item) {
16+
item.len = item.title.length;
17+
return item;
18+
}).sort(function (a, b) {
19+
return a.len - b.len;
20+
}).map(function(item) {
21+
return { title: item.title, subtitle: item.subtitle, arg: item.title };
22+
}).slice(0, 8);
23+
if (commands.length === 0) {
24+
commands.push({
25+
title: "没有搜素到内容",
26+
subtitle: "请尝试其它关键字",
27+
});
28+
}
29+
30+
const result = { items: commands };
31+
console.log(JSON.stringify(result));
32+
}
Collapse file

‎package.json‎

Copy file name to clipboardExpand all lines: package.json
+2-5Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "alfred-linux-command",
3-
"version": "1.0.0",
3+
"version": "1.2.2",
44
"description": "Search through the Linux command.",
55
"main": "index.js",
66
"scripts": {
@@ -30,8 +30,5 @@
3030
"node": ">=4"
3131
},
3232
"author": "kenny wang <wowohoo@qq.com>",
33-
"license": "MIT",
34-
"dependencies": {
35-
"alfy": "^0.6.0"
36-
}
33+
"license": "MIT"
3734
}

0 commit comments

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