mirror of
https://github.com/HeyPuter/puter.git
synced 2025-12-31 02:00:13 -06:00
Merge pull request #1113 from ProgrammerIn-wonderland/main
Added tab completion to PDEs
This commit is contained in:
@@ -158,29 +158,15 @@ export class PDECommandProvider {
|
||||
async complete (query, { ctx }) {
|
||||
if (query === '') return [];
|
||||
|
||||
const results = [];
|
||||
|
||||
// for (const app_name of BUILT_IN_APPS) {
|
||||
// if (app_name.startsWith(query)) {
|
||||
// results.push(app_name);
|
||||
// }
|
||||
// }
|
||||
|
||||
// const request = await fetch(`${puter.APIOrigin}/drivers/call`, {
|
||||
// "headers": {
|
||||
// "Content-Type": "application/json",
|
||||
// "Authorization": `Bearer ${puter.authToken}`,
|
||||
// },
|
||||
// "body": JSON.stringify({ interface: 'puter-apps', method: 'select', args: { predicate: [ 'name-like', query + '%' ] } }),
|
||||
// "method": "POST",
|
||||
// });
|
||||
|
||||
// const json = await request.json();
|
||||
// if (json.success) {
|
||||
// for (const app of json.result) {
|
||||
// results.push(app.name);
|
||||
// }
|
||||
// }
|
||||
const results = (await puter.fs.readdir("/admin/Public/bin/"))
|
||||
.map( (e) => {
|
||||
if (e.name.endsWith(".pde")) {
|
||||
return e.name.slice(0, -4)
|
||||
} else {
|
||||
return e.name
|
||||
}
|
||||
})
|
||||
.filter( (e) => e.startsWith(query));
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user