MCPcopy Index your code
hub / github.com/nodejs/node / completeFSFunctions

Function completeFSFunctions

lib/internal/repl/completion.js:166–186  ·  view source on GitHub ↗
(match)

Source from the content-addressed store, hash-verified

164}
165
166function completeFSFunctions(match) {
167 let baseName = '';
168 let filePath = match[1];
169 let fileList = gracefulReaddir(filePath, { withFileTypes: true });
170
171 if (!fileList) {
172 baseName = path.basename(filePath);
173 filePath = path.dirname(filePath);
174 fileList = gracefulReaddir(filePath, { withFileTypes: true }) || [];
175 }
176
177 const completions = ArrayPrototypeMap(
178 ArrayPrototypeFilter(
179 fileList,
180 (dirent) => StringPrototypeStartsWith(dirent.name, baseName),
181 ),
182 (d) => d.name,
183 );
184
185 return [[completions], baseName];
186}
187
188// Provide a list of completions for the given leading text. This is
189// given to the readline interface for handling tab completion.

Callers 1

completeFunction · 0.85

Calls 1

gracefulReaddirFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…