Update fetchScriptList to target scripts directory and remove autocompletion logic
This commit is contained in:
parent
7f69b3e59c
commit
606f200621
1 changed files with 1 additions and 17 deletions
18
loader.ts
18
loader.ts
|
|
@ -40,7 +40,7 @@ let DAEMON_PORT = chooseDaemonPort();
|
|||
// Removed cache-related code
|
||||
|
||||
async function fetchScriptList(ref: string = LOADER_REF): Promise<string[]> {
|
||||
const apiUrl = `${BASE_API}/contents?ref=${encodeURIComponent(ref)}`;
|
||||
const apiUrl = `${BASE_API}/contents/scripts?ref=${encodeURIComponent(ref)}`;
|
||||
const response = await fetch(apiUrl);
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to fetch scripts (${ref}): ${response.statusText}`);
|
||||
|
|
@ -51,22 +51,6 @@ async function fetchScriptList(ref: string = LOADER_REF): Promise<string[]> {
|
|||
.map((script: { name: string }) => script.name.replace(/\.ts$/, ""));
|
||||
}
|
||||
|
||||
// Function to register autocompletions for available scripts
|
||||
function registerAutocompletions(scripts: { name: string }[]) {
|
||||
const completions = scripts.map(script => script.name);
|
||||
// Logic to register completions in the Deno environment
|
||||
// This could involve using Deno's built-in completion features or a custom implementation
|
||||
console.log('Available script completions:', completions);
|
||||
}
|
||||
|
||||
// Update the existing function to fetch available scripts and register autocompletions
|
||||
async function _fetchAvailableScripts(ref: string = LOADER_REF) {
|
||||
const response = await fetch(`${BASE_API}/contents?ref=${encodeURIComponent(ref)}`);
|
||||
const scripts = await response.json();
|
||||
registerAutocompletions(scripts);
|
||||
return scripts;
|
||||
}
|
||||
|
||||
function _buildRawUrl(cmd: string, ref: string): string {
|
||||
// Heuristic: tags typically start with 'v', otherwise treat as branch
|
||||
const isTag = /^v[0-9]/.test(ref);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue