MCPcopy
hub / github.com/cyclops-ui/cyclops / readFiles

Function readFiles

cyclops-ctrl/pkg/template/git.go:495–537  ·  view source on GitHub ↗
(path string, fs billy.Filesystem)

Source from the content-addressed store, hash-verified

493}
494
495func readFiles(path string, fs billy.Filesystem) ([]*chart.File, error) {
496 files, err := fs.ReadDir(path)
497 if err != nil {
498 return nil, err
499 }
500
501 chartFiles := make([]*chart.File, 0)
502
503 for _, fileInfo := range files {
504 if fileInfo.IsDir() {
505 dirChartFiles, err := readFiles(path2.Join(path, fileInfo.Name()), fs)
506 if err != nil {
507 return nil, err
508 }
509
510 chartFiles = append(chartFiles, dirChartFiles...)
511 continue
512 }
513
514 ext := filepath.Ext(fileInfo.Name())
515 if ext == "yaml" {
516 continue
517 }
518
519 file, err := fs.Open(path2.Join(path, fileInfo.Name()))
520 if err != nil {
521 return nil, err
522 }
523
524 var b bytes.Buffer
525 _, err = io.Copy(bufio.NewWriter(&b), file)
526 if err != nil {
527 return nil, err
528 }
529
530 chartFiles = append(chartFiles, &chart.File{
531 Name: path2.Join(path, fileInfo.Name()),
532 Data: b.Bytes(),
533 })
534 }
535
536 return chartFiles, nil
537}
538
539func (r Repo) mapGitHubRepoTemplate(repoURL, path, commitSHA string, creds *auth.Credentials) (*models.Template, error) {
540 tgzData, err := gitproviders2.GitHubClone(repoURL, commitSHA, creds)

Callers 1

LoadTemplateMethod · 0.85

Calls 1

BytesMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…