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]
|
||||
|
||||
github := resource.NewGitHubClient(request.Source)
|
||||
command := resource.NewInCommand(github)
|
||||
command := resource.NewInCommand(github, os.Stderr)
|
||||
response, err := command.Run(destDir, request)
|
||||
if err != nil {
|
||||
resource.Fatal("running command", err)
|
||||
|
@@ -14,11 +14,13 @@ import (
|
||||
|
||||
type InCommand struct {
|
||||
github GitHub
|
||||
writer io.Writer
|
||||
}
|
||||
|
||||
func NewInCommand(github GitHub) *InCommand {
|
||||
func NewInCommand(github GitHub, writer io.Writer) *InCommand {
|
||||
return &InCommand{
|
||||
github: github,
|
||||
writer: writer,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,6 +83,7 @@ func (c *InCommand) Run(destDir string, request InRequest) (InResponse, error) {
|
||||
continue
|
||||
}
|
||||
|
||||
fmt.Fprintf(c.writer, "downloading asset: %s\n", *asset.Name)
|
||||
err := c.downloadFile(url, path)
|
||||
if err != nil {
|
||||
return InResponse{}, nil
|
||||
|
@@ -32,7 +32,7 @@ var _ = Describe("In Command", func() {
|
||||
var err error
|
||||
|
||||
githubClient = &fakes.FakeGitHub{}
|
||||
command = resource.NewInCommand(githubClient)
|
||||
command = resource.NewInCommand(githubClient, ioutil.Discard)
|
||||
|
||||
destDir, err = ioutil.TempDir("", "github-release")
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
|
Reference in New Issue
Block a user