From 9e05956efa2dbf1a7c6094787b18e860fe23ec25 Mon Sep 17 00:00:00 2001
From: Michelle Noorali <michellemolu@gmail.com>
Date: Tue, 19 Apr 2016 02:48:12 -0600
Subject: [PATCH] feat(fetch): stub out fetch command

---
 cmd/helm/fetch.go | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 cmd/helm/fetch.go

diff --git a/cmd/helm/fetch.go b/cmd/helm/fetch.go
new file mode 100644
index 000000000..2fe8dd0c5
--- /dev/null
+++ b/cmd/helm/fetch.go
@@ -0,0 +1,46 @@
+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
+}
-- 
GitLab