Skip to content

Commit

Permalink
Print number of files extracted regardless of error
Browse files Browse the repository at this point in the history
  • Loading branch information
Pete Emerson committed Oct 26, 2020
1 parent 35745be commit eaf98f5
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,15 +289,14 @@ func downloadSourcePaths(sourcePaths []string, destPath string, githubRepo GitHu
// Unzip and move the files we need to our destination
for _, sourcePath := range sourcePaths {
fmt.Printf("Extracting files from <repo>%s to %s ... ", sourcePath, destPath)
if fileCount, err := extractFiles(localZipFilePath, sourcePath, destPath); err != nil {
fmt.Println()
fileCount, err := extractFiles(localZipFilePath, sourcePath, destPath)
plural := ""
if fileCount != 1 {
plural = "s"
}
fmt.Printf("%d file%s extracted\n", fileCount, plural)
if err != nil {
return fmt.Errorf("Error occurred while extracting files from GitHub zip file: %s", err.Error())
} else {
plural := ""
if fileCount != 1 {
plural = "s"
}
fmt.Printf("%d file%s extracted\n", fileCount, plural)
}

}
Expand Down

0 comments on commit eaf98f5

Please sign in to comment.