MCPcopy
hub / github.com/helm/helm / newGetMetadataCmd

Function newGetMetadataCmd

pkg/cmd/get_metadata.go:38–77  ·  view source on GitHub ↗
(cfg *action.Configuration, out io.Writer)

Source from the content-addressed store, hash-verified

36}
37
38func newGetMetadataCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
39 var outfmt output.Format
40 client := action.NewGetMetadata(cfg)
41
42 cmd := &cobra.Command{
43 Use: "metadata RELEASE_NAME",
44 Short: "This command fetches metadata for a given release",
45 Args: require.ExactArgs(1),
46 ValidArgsFunction: func(_ *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
47 if len(args) != 0 {
48 return noMoreArgsComp()
49 }
50 return compListReleases(toComplete, args, cfg)
51 },
52 RunE: func(_ *cobra.Command, args []string) error {
53 releaseMetadata, err := client.Run(args[0])
54 if err != nil {
55 return err
56 }
57 return outfmt.Write(out, &metadataWriter{releaseMetadata})
58 },
59 }
60
61 f := cmd.Flags()
62 f.IntVar(&client.Version, "revision", 0, "specify release revision")
63 err := cmd.RegisterFlagCompletionFunc("revision", func(_ *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
64 if len(args) == 1 {
65 return compListRevisions(toComplete, cfg, args[0])
66 }
67 return nil, cobra.ShellCompDirectiveNoFileComp
68 })
69
70 if err != nil {
71 log.Fatal(err)
72 }
73
74 bindOutputFlag(cmd, &outfmt)
75
76 return cmd
77}
78
79func (w metadataWriter) WriteTable(out io.Writer) error {
80

Callers 1

newGetCmdFunction · 0.85

Calls 9

RunMethod · 0.95
WriteMethod · 0.95
NewGetMetadataFunction · 0.92
ExactArgsFunction · 0.92
noMoreArgsCompFunction · 0.85
compListReleasesFunction · 0.85
compListRevisionsFunction · 0.85
bindOutputFlagFunction · 0.85
FatalMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…