Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
23421f91
Commit
23421f91
authored
Jul 23, 2016
by
Grantseltzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add subcommands to specify only chart or values inspected
Signed-off-by:
Grantseltzer
<
grantseltzer@gmail.com
>
parent
877d9b28
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
9 deletions
+71
-9
inspect.go
cmd/helm/inspect.go
+70
-9
inspect_test.go
cmd/helm/inspect_test.go
+1
-0
No files found.
cmd/helm/inspect.go
View file @
23421f91
...
...
@@ -33,23 +33,40 @@ This command inspects a chart (directory, file, or URL) and displays information
Inspect prints the contents of the Chart.yaml file and the values.yaml file.
`
const
inspectValuesDesc
=
`
This command inspects a chart (directory, file, or URL) and displays the contents
of the values.yaml file
`
const
inspectChartDesc
=
`
This command inspects a chart (directory, file, or URL) and displays the contents
of the Charts.yaml file
`
type
inspectCmd
struct
{
chartpath
string
out
io
.
Writer
client
helm
.
Interface
output
string
out
io
.
Writer
client
helm
.
Interface
}
const
(
chartOnly
=
"chart"
valuesOnly
=
"values"
both
=
"both"
)
func
newInspectCmd
(
c
helm
.
Interface
,
out
io
.
Writer
)
*
cobra
.
Command
{
insp
:=
&
inspectCmd
{
client
:
c
,
out
:
out
,
output
:
both
,
}
cc
:=
&
cobra
.
Command
{
inspectCommand
:=
&
cobra
.
Command
{
Use
:
"inspect [CHART]"
,
Short
:
"inspect a chart"
,
Long
:
ins
tall
Desc
,
Long
:
ins
pect
Desc
,
RunE
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
if
err
:=
checkArgsLength
(
1
,
len
(
args
),
"chart name"
);
err
!=
nil
{
return
err
...
...
@@ -62,7 +79,41 @@ func newInspectCmd(c helm.Interface, out io.Writer) *cobra.Command {
return
insp
.
run
()
},
}
return
cc
valuesSubCmd
:=
&
cobra
.
Command
{
Use
:
"values"
,
Short
:
"shows inspect values"
,
Long
:
inspectValuesDesc
,
RunE
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
insp
.
output
=
valuesOnly
cp
,
err
:=
locateChartPath
(
args
[
0
])
if
err
!=
nil
{
return
err
}
insp
.
chartpath
=
cp
return
insp
.
run
()
},
}
chartSubCmd
:=
&
cobra
.
Command
{
Use
:
"chart"
,
Short
:
"shows inspect chart"
,
Long
:
inspectChartDesc
,
RunE
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
insp
.
output
=
chartOnly
cp
,
err
:=
locateChartPath
(
args
[
0
])
if
err
!=
nil
{
return
err
}
insp
.
chartpath
=
cp
return
insp
.
run
()
},
}
inspectCommand
.
AddCommand
(
valuesSubCmd
)
inspectCommand
.
AddCommand
(
chartSubCmd
)
return
inspectCommand
}
func
(
i
*
inspectCmd
)
run
()
error
{
...
...
@@ -74,8 +125,18 @@ func (i *inspectCmd) run() error {
if
err
!=
nil
{
return
err
}
fmt
.
Fprintln
(
i
.
out
,
string
(
cf
))
fmt
.
Fprintln
(
i
.
out
,
"---"
)
fmt
.
Fprintln
(
i
.
out
,
chrt
.
Values
.
Raw
)
if
i
.
output
==
chartOnly
||
i
.
output
==
both
{
fmt
.
Fprintln
(
i
.
out
,
string
(
cf
))
}
if
i
.
output
==
both
{
fmt
.
Fprintln
(
i
.
out
,
"---"
)
}
if
i
.
output
==
valuesOnly
||
i
.
output
==
both
{
fmt
.
Fprintln
(
i
.
out
,
chrt
.
Values
.
Raw
)
}
return
nil
}
cmd/helm/inspect_test.go
View file @
23421f91
...
...
@@ -28,6 +28,7 @@ func TestInspect(t *testing.T) {
insp
:=
&
inspectCmd
{
chartpath
:
"testdata/testcharts/alpine"
,
output
:
"both"
,
out
:
b
,
}
insp
.
run
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment