MCPcopy
hub / github.com/apache/answer / formatUIPluginsDirName

Function formatUIPluginsDirName

internal/cli/build.go:561–578  ·  view source on GitHub ↗

format plugins dir name from dash to underline

(dirPath string)

Source from the content-addressed store, hash-verified

559
560// format plugins dir name from dash to underline
561func formatUIPluginsDirName(dirPath string) {
562 entries, err := os.ReadDir(dirPath)
563 if err != nil {
564 fmt.Printf("read ui plugins dir failed: [%s] %s\n", dirPath, err)
565 return
566 }
567 for _, entry := range entries {
568 if !entry.IsDir() || !strings.Contains(entry.Name(), "-") {
569 continue
570 }
571 newName := strings.ReplaceAll(entry.Name(), "-", "_")
572 if err := os.Rename(filepath.Join(dirPath, entry.Name()), filepath.Join(dirPath, newName)); err != nil {
573 fmt.Printf("rename ui plugins dir failed: [%s] %s\n", dirPath, err)
574 } else {
575 fmt.Printf("rename ui plugins dir success: [%s] -> [%s]\n", entry.Name(), newName)
576 }
577 }
578}
579
580// buildBinary build binary file
581func buildBinary(b *buildingMaterial) (err error) {

Callers 1

copyUIFilesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected