write progress while downloading assets
[#76848252] Signed-off-by: Alex Suraci <asuraci@pivotal.io>
This commit is contained in:
@@ -19,7 +19,7 @@ func main() {
|
|||||||
destDir := os.Args[1]
|
destDir := os.Args[1]
|
||||||
|
|
||||||
github := resource.NewGitHubClient(request.Source)
|
github := resource.NewGitHubClient(request.Source)
|
||||||
command := resource.NewInCommand(github)
|
command := resource.NewInCommand(github, os.Stderr)
|
||||||
response, err := command.Run(destDir, request)
|
response, err := command.Run(destDir, request)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
resource.Fatal("running command", err)
|
resource.Fatal("running command", err)
|
||||||
|
@@ -14,11 +14,13 @@ import (
|
|||||||
|
|
||||||
type InCommand struct {
|
type InCommand struct {
|
||||||
github GitHub
|
github GitHub
|
||||||
|
writer io.Writer
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewInCommand(github GitHub) *InCommand {
|
func NewInCommand(github GitHub, writer io.Writer) *InCommand {
|
||||||
return &InCommand{
|
return &InCommand{
|
||||||
github: github,
|
github: github,
|
||||||
|
writer: writer,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,6 +83,7 @@ func (c *InCommand) Run(destDir string, request InRequest) (InResponse, error) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Fprintf(c.writer, "downloading asset: %s\n", *asset.Name)
|
||||||
err := c.downloadFile(url, path)
|
err := c.downloadFile(url, path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return InResponse{}, nil
|
return InResponse{}, nil
|
||||||
|
@@ -32,7 +32,7 @@ var _ = Describe("In Command", func() {
|
|||||||
var err error
|
var err error
|
||||||
|
|
||||||
githubClient = &fakes.FakeGitHub{}
|
githubClient = &fakes.FakeGitHub{}
|
||||||
command = resource.NewInCommand(githubClient)
|
command = resource.NewInCommand(githubClient, ioutil.Discard)
|
||||||
|
|
||||||
destDir, err = ioutil.TempDir("", "github-release")
|
destDir, err = ioutil.TempDir("", "github-release")
|
||||||
Ω(err).ShouldNot(HaveOccurred())
|
Ω(err).ShouldNot(HaveOccurred())
|
||||||
|
Reference in New Issue
Block a user