Skip to content
This repository has been archived by the owner on Jan 28, 2022. It is now read-only.

Commit

Permalink
Loading bar adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
sclevine committed Mar 23, 2017
1 parent 6efb359 commit 456cdba
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 17 deletions.
10 changes: 5 additions & 5 deletions local/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,12 @@ func (r *Runner) Export(config *ExportConfig, reference string) (imageID string,
}

func (r *Runner) pull() error {
body, err := r.Docker.ImagePull(context.Background(), "cloudfoundry/cflinuxfs2:"+r.StackVersion, types.ImagePullOptions{})
if err != nil {
return err
}
defer body.Close()
return r.UI.Loading("Pulling cflinuxfs2", func() error {
body, err := r.Docker.ImagePull(context.Background(), "cloudfoundry/cflinuxfs2:"+r.StackVersion, types.ImagePullOptions{})
if err != nil {
return err
}
defer body.Close()
return checkBody(body)
})
}
Expand Down
22 changes: 11 additions & 11 deletions local/stager.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,18 +202,18 @@ func (s *Stager) buildDockerfile() error {
if err != nil {
return err
}
response, err := s.Docker.ImageBuild(context.Background(), dockerfileTar, types.ImageBuildOptions{
Tags: []string{"cflocal"},
SuppressOutput: true,
PullParent: true,
Remove: true,
ForceRemove: true,
})
if err != nil {
return err
}
defer response.Body.Close()
return s.UI.Loading("Building Diego-powered base image", func() error {
response, err := s.Docker.ImageBuild(context.Background(), dockerfileTar, types.ImageBuildOptions{
Tags: []string{"cflocal"},
SuppressOutput: true,
PullParent: true,
Remove: true,
ForceRemove: true,
})
if err != nil {
return err
}
defer response.Body.Close()
return checkBody(response.Body)
})
}
5 changes: 4 additions & 1 deletion ui/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ func (u *UI) Loading(message string, f func() error) error {
ticks++
case err := <-doneChan:
if ticks > 0 {
fmt.Fprint(u.Out, "\r")
fmt.Fprintf(u.Out, "\r%s %s\r",
strings.Repeat(" ", len(message)),
strings.Repeat(" ", spinnerWidth),
)
}
return err
}
Expand Down

0 comments on commit 456cdba

Please sign in to comment.