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
49795ad9
Commit
49795ad9
authored
Mar 18, 2016
by
jackgr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add chart content loading
parent
131ddcbc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
5 deletions
+33
-5
chart.go
pkg/chart/chart.go
+33
-5
No files found.
pkg/chart/chart.go
View file @
49795ad9
...
...
@@ -377,12 +377,21 @@ func (c *Chart) loadDirectory(dir string) ([]*ChartMember, error) {
members
:=
[]
*
ChartMember
{}
for
_
,
file
:=
range
files
{
filename
:=
filepath
.
Join
(
dir
,
file
.
Name
())
member
,
err
:=
c
.
loadMember
(
filename
)
if
err
!=
nil
{
return
nil
,
err
}
if
!
file
.
IsDir
()
{
addition
,
err
:=
c
.
loadMember
(
filename
)
if
err
!=
nil
{
return
nil
,
err
}
members
=
append
(
members
,
addition
)
}
else
{
additions
,
err
:=
c
.
loadDirectory
(
filename
)
if
err
!=
nil
{
return
nil
,
err
}
members
=
append
(
members
,
member
)
members
=
append
(
members
,
additions
...
)
}
}
return
members
,
nil
...
...
@@ -416,3 +425,22 @@ func (c *Chart) loadMember(filename string) (*ChartMember, error) {
return
result
,
nil
}
type
ChartContent
struct
{
Chartfile
*
Chartfile
`json:"chartfile"`
Members
[]
*
ChartMember
`json:"templates"`
}
func
(
c
*
Chart
)
LoadContent
()
(
*
ChartContent
,
error
)
{
ms
,
err
:=
c
.
loadDirectory
(
c
.
Dir
())
if
err
!=
nil
{
return
nil
,
err
}
cc
:=
&
ChartContent
{
Chartfile
:
c
.
Chartfile
(),
Members
:
ms
,
}
return
cc
,
nil
}
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