mirror of
https://github.com/helm/helm.git
synced 2026-08-08 09:01:25 +00:00
Port --devel flag from v2 to v3
Helm v2 PR #5141 Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
This commit is contained in:
@@ -77,11 +77,7 @@ func newShowCmd(out io.Writer) *cobra.Command {
|
||||
Args: require.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
client.OutputFormat = action.ShowAll
|
||||
cp, err := client.ChartPathOptions.LocateChart(args[0], settings)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
output, err := client.Run(cp)
|
||||
output, err := runShow(args, client)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -97,11 +93,7 @@ func newShowCmd(out io.Writer) *cobra.Command {
|
||||
Args: require.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
client.OutputFormat = action.ShowValues
|
||||
cp, err := client.ChartPathOptions.LocateChart(args[0], settings)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
output, err := client.Run(cp)
|
||||
output, err := runShow(args, client)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -117,11 +109,7 @@ func newShowCmd(out io.Writer) *cobra.Command {
|
||||
Args: require.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
client.OutputFormat = action.ShowChart
|
||||
cp, err := client.ChartPathOptions.LocateChart(args[0], settings)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
output, err := client.Run(cp)
|
||||
output, err := runShow(args, client)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -137,11 +125,7 @@ func newShowCmd(out io.Writer) *cobra.Command {
|
||||
Args: require.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
client.OutputFormat = action.ShowReadme
|
||||
cp, err := client.ChartPathOptions.LocateChart(args[0], settings)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
output, err := client.Run(cp)
|
||||
output, err := runShow(args, client)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -152,8 +136,7 @@ func newShowCmd(out io.Writer) *cobra.Command {
|
||||
|
||||
cmds := []*cobra.Command{all, readmeSubCmd, valuesSubCmd, chartSubCmd}
|
||||
for _, subCmd := range cmds {
|
||||
addChartPathOptionsFlags(subCmd.Flags(), &client.ChartPathOptions)
|
||||
showCommand.AddCommand(subCmd)
|
||||
addShowFlags(showCommand, subCmd, client)
|
||||
|
||||
// Register the completion function for each subcommand
|
||||
completion.RegisterValidArgsFunc(subCmd, validArgsFunc)
|
||||
@@ -161,3 +144,25 @@ func newShowCmd(out io.Writer) *cobra.Command {
|
||||
|
||||
return showCommand
|
||||
}
|
||||
|
||||
func addShowFlags(showCmd *cobra.Command, subCmd *cobra.Command, client *action.Show) {
|
||||
f := subCmd.Flags()
|
||||
|
||||
f.BoolVar(&client.Devel, "devel", false, "use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored")
|
||||
addChartPathOptionsFlags(f, &client.ChartPathOptions)
|
||||
showCmd.AddCommand(subCmd)
|
||||
}
|
||||
|
||||
func runShow(args []string, client *action.Show) (string, error) {
|
||||
debug("Original chart version: %q", client.Version)
|
||||
if client.Version == "" && client.Devel {
|
||||
debug("setting version to >0.0.0-0")
|
||||
client.Version = ">0.0.0-0"
|
||||
}
|
||||
|
||||
cp, err := client.ChartPathOptions.LocateChart(args[0], settings)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return client.Run(cp)
|
||||
}
|
||||
|
||||
2
go.mod
2
go.mod
@@ -4,6 +4,7 @@ go 1.13
|
||||
|
||||
require (
|
||||
github.com/BurntSushi/toml v0.3.1
|
||||
github.com/Masterminds/semver v1.5.0 // indirect
|
||||
github.com/Masterminds/semver/v3 v3.0.3
|
||||
github.com/Masterminds/sprig/v3 v3.0.2
|
||||
github.com/Masterminds/vcs v1.13.1
|
||||
@@ -34,6 +35,7 @@ require (
|
||||
k8s.io/apimachinery v0.17.3
|
||||
k8s.io/cli-runtime v0.17.3
|
||||
k8s.io/client-go v0.17.3
|
||||
k8s.io/helm v2.16.3+incompatible
|
||||
k8s.io/klog v1.0.0
|
||||
k8s.io/kubectl v0.17.3
|
||||
sigs.k8s.io/yaml v1.1.0
|
||||
|
||||
4
go.sum
4
go.sum
@@ -28,6 +28,8 @@ github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd h1:sjQovDkwrZp
|
||||
github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd/go.mod h1:64YHyfSL2R96J44Nlwm39UHepQbyR5q10x7iYa1ks2E=
|
||||
github.com/Masterminds/goutils v1.1.0 h1:zukEsf/1JZwCMgHiK3GZftabmxiCw4apj3a28RPBiVg=
|
||||
github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
|
||||
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
|
||||
github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
|
||||
github.com/Masterminds/semver/v3 v3.0.3 h1:znjIyLfpXEDQjOIEWh+ehwpTU14UzUPub3c3sm36u14=
|
||||
github.com/Masterminds/semver/v3 v3.0.3/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
|
||||
github.com/Masterminds/sprig/v3 v3.0.2 h1:wz22D0CiSctrliXiI9ZO3HoNApweeRGftyDN+BQa3B8=
|
||||
@@ -653,6 +655,8 @@ k8s.io/component-base v0.17.3 h1:hQzTSshY14aLSR6WGIYvmw+w+u6V4d+iDR2iDGMrlUg=
|
||||
k8s.io/component-base v0.17.3/go.mod h1:GeQf4BrgelWm64PXkIXiPh/XS0hnO42d9gx9BtbZRp8=
|
||||
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
|
||||
k8s.io/gengo v0.0.0-20190822140433-26a664648505/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
|
||||
k8s.io/helm v2.16.3+incompatible h1:MGUcXcG1uAXWZmxu4vzzgRjZOnfFUsSJbHgqM+kyqzM=
|
||||
k8s.io/helm v2.16.3+incompatible/go.mod h1:LZzlS4LQBHfciFOurYBFkCMTaZ0D1l+p0teMg7TSULI=
|
||||
k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
|
||||
k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
|
||||
k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8=
|
||||
|
||||
@@ -51,8 +51,9 @@ func (o ShowOutputFormat) String() string {
|
||||
//
|
||||
// It provides the implementation of 'helm show' and its respective subcommands.
|
||||
type Show struct {
|
||||
OutputFormat ShowOutputFormat
|
||||
ChartPathOptions
|
||||
Devel bool
|
||||
OutputFormat ShowOutputFormat
|
||||
}
|
||||
|
||||
// NewShow creates a new Show object with the given configuration.
|
||||
|
||||
Reference in New Issue
Block a user