MCPcopy Create free account
hub / github.com/devld/go-drive / ListDriveScripts

Function ListDriveScripts

drive/script/script_utils.go:214–233  ·  view source on GitHub ↗
(config common.Config)

Source from the content-addressed store, hash-verified

212}
213
214func ListDriveScripts(config common.Config) ([]DriveScript, error) {
215 scriptsPath, _ := config.GetDir(config.DrivesDir, false)
216 entries, e := os.ReadDir(scriptsPath)
217 if e != nil {
218 return []DriveScript{}, nil
219 }
220 result := make([]DriveScript, 0)
221 for _, entry := range entries {
222 n := strings.ToLower(entry.Name())
223 if !strings.HasSuffix(n, ".js") {
224 continue
225 }
226 ds, e := readDriveScriptMeta(entry.Name(), config)
227 if e != nil {
228 continue
229 }
230 result = append(result, ds)
231 }
232 return result, nil
233}
234
235func readDriveScriptMeta(file string, config common.Config) (DriveScript, error) {
236 scriptsPath, _ := config.GetDir(config.DrivesDir, false)

Callers 2

getInstalledDrivesMethod · 0.92
initFunction · 0.85

Calls 4

readDriveScriptMetaFunction · 0.85
GetDirMethod · 0.80
NameMethod · 0.65
ReadDirMethod · 0.45

Tested by

no test coverage detected