MCPcopy Index your code
hub / github.com/helm/helm / compVersionFlag

Function compVersionFlag

pkg/cmd/flags.go:253–286  ·  view source on GitHub ↗
(chartRef string, _ string)

Source from the content-addressed store, hash-verified

251}
252
253func compVersionFlag(chartRef string, _ string) ([]string, cobra.ShellCompDirective) {
254 chartInfo := strings.Split(chartRef, "/")
255 if len(chartInfo) != 2 {
256 return nil, cobra.ShellCompDirectiveNoFileComp
257 }
258
259 repoName := chartInfo[0]
260 chartName := chartInfo[1]
261
262 path := filepath.Join(settings.RepositoryCache, helmpath.CacheIndexFile(repoName))
263
264 var versions []string
265 if indexFile, err := repo.LoadIndexFile(path); err == nil {
266 for _, details := range indexFile.Entries[chartName] {
267 appVersion := details.AppVersion
268 appVersionDesc := ""
269 if appVersion != "" {
270 appVersionDesc = fmt.Sprintf("App: %s, ", appVersion)
271 }
272 created := details.Created.Format("January 2, 2006")
273 createdDesc := ""
274 if created != "" {
275 createdDesc = fmt.Sprintf("Created: %s ", created)
276 }
277 deprecated := ""
278 if details.Deprecated {
279 deprecated = "(deprecated)"
280 }
281 versions = append(versions, fmt.Sprintf("%s\t%s%s%s", details.Version, appVersionDesc, createdDesc, deprecated))
282 }
283 }
284
285 return versions, cobra.ShellCompDirectiveNoFileComp
286}
287
288// addKlogFlags adds flags from k8s.io/klog
289// marks the flags as hidden to avoid polluting the help text

Callers 4

newPullCmdFunction · 0.85
addInstallFlagsFunction · 0.85
addShowFlagsFunction · 0.85
newUpgradeCmdFunction · 0.85

Calls 1

CacheIndexFileFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…