webide-cli 0.0.1-alpha.6 → 0.0.1-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +1 -0
  2. package/index.js +20 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -4,6 +4,7 @@ QQ群:1050254184
4
4
  # 安装
5
5
  1. 安装NodeJS和NPM:(如已安装,则跳过此步骤)
6
6
  ```bash
7
+ # WebIDE内置的Alpine Linux系统,该CLI仅限WebIDE使用
7
8
  apk add nodejs
8
9
  apk add npm
9
10
  # 验证是否已安装
package/index.js CHANGED
@@ -80,7 +80,7 @@ program
80
80
  program
81
81
  .command('remove <name>')
82
82
  .description('Remove a library')
83
- .action(function (libname) {
83
+ .action(function (libname) {
84
84
  const libPath = path.join(workdir, 'libs', libname);
85
85
  if (fs.existsSync(libPath)) {
86
86
  fs.rmSync(libPath, { recursive: true, force: true });
@@ -90,6 +90,19 @@ program
90
90
  }
91
91
  });
92
92
 
93
+ program
94
+ .command('search <keyword>')
95
+ .description('Search for libraries')
96
+ .action(async function (keyword) {
97
+ const load = loading(`Searching for libraries with keyword "${keyword}" ...`);
98
+ const results = await search(keyword);
99
+ load();
100
+ console.log("\r\nSearch results(" + results.length + " items):");
101
+ for (const lib of results) {
102
+ console.log(` ${lib.name.replaceAll(keyword, `\x1b[43;30m${keyword}\x1b[0m`)}`);
103
+ }
104
+ });
105
+
93
106
  program
94
107
  .parse(process.argv);
95
108
 
@@ -134,4 +147,10 @@ async function download(path, savepath) {
134
147
  const bufferData = Buffer.from(await fileData.arrayBuffer());
135
148
  fs.writeFileSync(filepath, bufferData);
136
149
  }
150
+ }
151
+
152
+ async function search(keyword) {
153
+ const { data, error } = await bucket.list('');
154
+ if (error) throw error;
155
+ return data.filter(file => file.name.includes(keyword));
137
156
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webide-cli",
3
- "version": "0.0.1-alpha.6",
3
+ "version": "0.0.1-alpha.7",
4
4
  "description": "A CLI for NEW WebIDE",
5
5
  "keywords": [
6
6
  "WebIDE",