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
9e05956e
Commit
9e05956e
authored
Apr 19, 2016
by
Michelle Noorali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(fetch): stub out fetch command
parent
2e1701be
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
0 deletions
+46
-0
fetch.go
cmd/helm/fetch.go
+46
-0
No files found.
cmd/helm/fetch.go
0 → 100644
View file @
9e05956e
package
main
import
(
"fmt"
"io"
"net/http"
"os"
"github.com/spf13/cobra"
)
func
init
()
{
RootCommand
.
AddCommand
(
fetchCmd
)
}
var
fetchCmd
=
&
cobra
.
Command
{
Use
:
"fetch"
,
Short
:
"Download a chart from a repository and unpack it in local directory."
,
Long
:
""
,
RunE
:
Fetch
,
}
func
Fetch
(
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
// parse args
// get download url
// call download url
out
,
err
:=
os
.
Create
(
"nginx-2.0.0.tgz"
)
if
err
!=
nil
{
return
err
}
defer
out
.
Close
()
resp
,
err
:=
http
.
Get
(
"http://localhost:8879/charts/nginx-2.0.0.tgz"
)
fmt
.
Println
(
"after req"
)
// unpack file
if
err
!=
nil
{
return
err
}
defer
resp
.
Body
.
Close
()
_
,
err
=
io
.
Copy
(
out
,
resp
.
Body
)
if
err
!=
nil
{
return
err
}
return
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