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.
- package/README.md +1 -0
- package/index.js +20 -1
- package/package.json +1 -1
package/README.md
CHANGED
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
|
}
|