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

Method installDrive

server/api_admin_drives.go:194–212  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

192}
193
194func (sdr *scriptDrivesRoute) installDrive(c *gin.Context) {
195 name := c.Param("name")
196 scripts, e := sdr._loadAvailableDriveScripts(c.Request.Context(), false)
197 if e != nil {
198 _ = c.Error(e)
199 return
200 }
201
202 ads, ok := utils.ArrayFind(scripts, func(item script.AvailableDriveScript, _ int) bool { return item.Name == name })
203 if !ok {
204 _ = c.Error(err.NewNotFoundError())
205 return
206 }
207
208 if e := script.InstallDriveScript(c.Request.Context(), sdr.config, ads); e != nil {
209 _ = c.Error(e)
210 return
211 }
212}
213
214func (sdr *scriptDrivesRoute) uninstallDrive(c *gin.Context) {
215 name := c.Param("name")

Callers

nothing calls this directly

Calls 4

ArrayFindFunction · 0.92
InstallDriveScriptFunction · 0.92
ErrorMethod · 0.65

Tested by

no test coverage detected