MCPcopy
hub / github.com/helm/helm / run

Method run

pkg/cmd/repo_remove.go:61–82  ·  view source on GitHub ↗
(out io.Writer)

Source from the content-addressed store, hash-verified

59}
60
61func (o *repoRemoveOptions) run(out io.Writer) error {
62 r, err := repo.LoadFile(o.repoFile)
63 if isNotExist(err) || len(r.Repositories) == 0 {
64 return errors.New("no repositories configured")
65 }
66
67 for _, name := range o.names {
68 if !r.Remove(name) {
69 return fmt.Errorf("no repo named %q found", name)
70 }
71 if err := r.WriteFile(o.repoFile, 0600); err != nil {
72 return err
73 }
74
75 if err := removeRepoCache(o.repoCache, name); err != nil {
76 return err
77 }
78 fmt.Fprintf(out, "%q has been removed from your repositories\n", name)
79 }
80
81 return nil
82}
83
84func removeRepoCache(root, name string) error {
85 idx := filepath.Join(root, helmpath.CacheChartsFile(name))

Callers 2

TestRepoRemoveFunction · 0.95
newRepoRemoveCmdFunction · 0.95

Calls 4

isNotExistFunction · 0.85
removeRepoCacheFunction · 0.85
RemoveMethod · 0.45
WriteFileMethod · 0.45

Tested by 1

TestRepoRemoveFunction · 0.76