ref: rename inspect to show (#4927)

Per the Helm 3 plan, `helm inspect` and all of its subcommands have been moved to `helm show`.

Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
pull/4946/head
Matt Butcher 7 years ago committed by GitHub
parent f9d3280841
commit b290247efa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -63,7 +63,7 @@ func newRootCmd(c helm.Interface, out io.Writer, args []string) *cobra.Command {
newCreateCmd(out), newCreateCmd(out),
newDependencyCmd(out), newDependencyCmd(out),
newPullCmd(out), newPullCmd(out),
newInspectCmd(out), newShowCmd(out),
newLintCmd(out), newLintCmd(out),
newPackageCmd(out), newPackageCmd(out),
newRepoCmd(out), newRepoCmd(out),

@ -29,19 +29,19 @@ import (
"k8s.io/helm/pkg/chart/loader" "k8s.io/helm/pkg/chart/loader"
) )
const inspectDesc = ` const showDesc = `
This command inspects a chart and displays information. It takes a chart reference This command inspects a chart and displays information. It takes a chart reference
('stable/drupal'), a full path to a directory or packaged chart, or a URL. ('stable/drupal'), a full path to a directory or packaged chart, or a URL.
Inspect prints the contents of the Chart.yaml file and the values.yaml file. Inspect prints the contents of the Chart.yaml file and the values.yaml file.
` `
const inspectValuesDesc = ` const showValuesDesc = `
This command inspects a chart (directory, file, or URL) and displays the contents This command inspects a chart (directory, file, or URL) and displays the contents
of the values.yaml file of the values.yaml file
` `
const inspectChartDesc = ` const showChartDesc = `
This command inspects a chart (directory, file, or URL) and displays the contents This command inspects a chart (directory, file, or URL) and displays the contents
of the Charts.yaml file of the Charts.yaml file
` `
@ -51,7 +51,7 @@ This command inspects a chart (directory, file, or URL) and displays the content
of the README file of the README file
` `
type inspectOptions struct { type showOptions struct {
chartpath string chartpath string
output string output string
@ -67,14 +67,15 @@ const (
var readmeFileNames = []string{"readme.md", "readme.txt", "readme"} var readmeFileNames = []string{"readme.md", "readme.txt", "readme"}
func newInspectCmd(out io.Writer) *cobra.Command { func newShowCmd(out io.Writer) *cobra.Command {
o := &inspectOptions{output: all} o := &showOptions{output: all}
inspectCommand := &cobra.Command{ showCommand := &cobra.Command{
Use: "inspect [CHART]", Use: "show [CHART]",
Short: "inspect a chart", Short: "inspect a chart",
Long: inspectDesc, Aliases: []string{"inspect"},
Args: require.ExactArgs(1), Long: showDesc,
Args: require.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
cp, err := o.locateChart(args[0]) cp, err := o.locateChart(args[0])
if err != nil { if err != nil {
@ -87,8 +88,8 @@ func newInspectCmd(out io.Writer) *cobra.Command {
valuesSubCmd := &cobra.Command{ valuesSubCmd := &cobra.Command{
Use: "values [CHART]", Use: "values [CHART]",
Short: "shows inspect values", Short: "shows values for this chart",
Long: inspectValuesDesc, Long: showValuesDesc,
Args: require.ExactArgs(1), Args: require.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
o.output = valuesOnly o.output = valuesOnly
@ -103,8 +104,8 @@ func newInspectCmd(out io.Writer) *cobra.Command {
chartSubCmd := &cobra.Command{ chartSubCmd := &cobra.Command{
Use: "chart [CHART]", Use: "chart [CHART]",
Short: "shows inspect chart", Short: "shows the chart",
Long: inspectChartDesc, Long: showChartDesc,
Args: require.ExactArgs(1), Args: require.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
o.output = chartOnly o.output = chartOnly
@ -119,7 +120,7 @@ func newInspectCmd(out io.Writer) *cobra.Command {
readmeSubCmd := &cobra.Command{ readmeSubCmd := &cobra.Command{
Use: "readme [CHART]", Use: "readme [CHART]",
Short: "shows inspect readme", Short: "shows the chart's README",
Long: readmeChartDesc, Long: readmeChartDesc,
Args: require.ExactArgs(1), Args: require.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -133,19 +134,19 @@ func newInspectCmd(out io.Writer) *cobra.Command {
}, },
} }
cmds := []*cobra.Command{inspectCommand, readmeSubCmd, valuesSubCmd, chartSubCmd} cmds := []*cobra.Command{showCommand, readmeSubCmd, valuesSubCmd, chartSubCmd}
for _, subCmd := range cmds { for _, subCmd := range cmds {
o.chartPathOptions.addFlags(subCmd.Flags()) o.chartPathOptions.addFlags(subCmd.Flags())
} }
for _, subCmd := range cmds[1:] { for _, subCmd := range cmds[1:] {
inspectCommand.AddCommand(subCmd) showCommand.AddCommand(subCmd)
} }
return inspectCommand return showCommand
} }
func (i *inspectOptions) run(out io.Writer) error { func (i *showOptions) run(out io.Writer) error {
chrt, err := loader.Load(i.chartpath) chrt, err := loader.Load(i.chartpath)
if err != nil { if err != nil {
return err return err

@ -23,10 +23,10 @@ import (
"testing" "testing"
) )
func TestInspect(t *testing.T) { func TestShow(t *testing.T) {
b := bytes.NewBuffer(nil) b := bytes.NewBuffer(nil)
o := &inspectOptions{ o := &showOptions{
chartpath: "testdata/testcharts/alpine", chartpath: "testdata/testcharts/alpine",
output: all, output: all,
} }
@ -67,7 +67,7 @@ func TestInspect(t *testing.T) {
// Regression tests for missing values. See issue #1024. // Regression tests for missing values. See issue #1024.
b.Reset() b.Reset()
o = &inspectOptions{ o = &showOptions{
chartpath: "testdata/testcharts/novals", chartpath: "testdata/testcharts/novals",
output: "values", output: "values",
} }
Loading…
Cancel
Save