(cfg *action.Configuration, out io.Writer)
| 38 | } |
| 39 | |
| 40 | func newGetValuesCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { |
| 41 | var outfmt output.Format |
| 42 | client := action.NewGetValues(cfg) |
| 43 | |
| 44 | cmd := &cobra.Command{ |
| 45 | Use: "values RELEASE_NAME", |
| 46 | Short: "download the values file for a named release", |
| 47 | Long: getValuesHelp, |
| 48 | Args: require.ExactArgs(1), |
| 49 | ValidArgsFunction: func(_ *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { |
| 50 | if len(args) != 0 { |
| 51 | return noMoreArgsComp() |
| 52 | } |
| 53 | return compListReleases(toComplete, args, cfg) |
| 54 | }, |
| 55 | RunE: func(_ *cobra.Command, args []string) error { |
| 56 | vals, err := client.Run(args[0]) |
| 57 | if err != nil { |
| 58 | return err |
| 59 | } |
| 60 | return outfmt.Write(out, &valuesWriter{vals, client.AllValues}) |
| 61 | }, |
| 62 | } |
| 63 | |
| 64 | f := cmd.Flags() |
| 65 | f.IntVar(&client.Version, "revision", 0, "get the named release with revision") |
| 66 | err := cmd.RegisterFlagCompletionFunc("revision", func(_ *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { |
| 67 | if len(args) == 1 { |
| 68 | return compListRevisions(toComplete, cfg, args[0]) |
| 69 | } |
| 70 | return nil, cobra.ShellCompDirectiveNoFileComp |
| 71 | }) |
| 72 | |
| 73 | if err != nil { |
| 74 | log.Fatal(err) |
| 75 | } |
| 76 | |
| 77 | f.BoolVarP(&client.AllValues, "all", "a", false, "dump all (computed) values") |
| 78 | bindOutputFlag(cmd, &outfmt) |
| 79 | |
| 80 | return cmd |
| 81 | } |
| 82 | |
| 83 | func (v valuesWriter) WriteTable(out io.Writer) error { |
| 84 | if v.allValues { |
no test coverage detected
searching dependent graphs…