Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions cmd/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func runDownload(cfg config.Config, flags *pflag.FlagSet, args []string) error {
return err
}

var successes int
for _, sf := range download.payload.files() {
url, err := sf.url()
if err != nil {
Expand All @@ -98,8 +99,10 @@ func runDownload(cfg config.Config, flags *pflag.FlagSet, args []string) error {
defer res.Body.Close()

if res.StatusCode != http.StatusOK {
// TODO: deal with it
continue
if successes > 0 {
Comment thread
glennj marked this conversation as resolved.
fmt.Fprintf(Err, "Downloaded %d/%d files\n", successes, len(download.payload.files()))
}
return fmt.Errorf("received HTTP/%d when fetching %#v", res.StatusCode, url)
}

path := sf.relativePath()
Expand All @@ -117,6 +120,7 @@ func runDownload(cfg config.Config, flags *pflag.FlagSet, args []string) error {
if err != nil {
return err
}
successes++
}
fmt.Fprintf(Err, "\nDownloaded to\n")
fmt.Fprintf(Out, "%s\n", metadata.Dir)
Expand Down