Skip to content

Commit

Permalink
- Updated to v2 of progress bar to fix issue.
Browse files Browse the repository at this point in the history
- Added badges to readme.
  • Loading branch information
Kristoffer Ahl committed Jan 9, 2019
1 parent 78a60ee commit c039b75
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

A tool for doing common AWS S3 tasks

[![Docker Automated build](https://img.shields.io/docker/automated/dotnetmentor/aws-s3.svg?style=for-the-badge)](https://hub.docker.com/r/dotnetmentor/aws-s3/)
[![Docker Build Status](https://img.shields.io/docker/build/dotnetmentor/aws-s3.svg?style=for-the-badge)](https://hub.docker.com/r/dotnetmentor/aws-s3/)
[![MicroBadger Size](https://img.shields.io/microbadger/image-size/dotnetmentor/aws-s3.svg?style=for-the-badge)](https://hub.docker.com/r/dotnetmentor/aws-s3/)
[![Docker Pulls](https://img.shields.io/docker/pulls/dotnetmentor/aws-s3.svg?style=for-the-badge)](https://hub.docker.com/r/dotnetmentor/aws-s3/)

## Commands

### Prune command
Expand Down
10 changes: 4 additions & 6 deletions prune_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/mitchellh/cli"
"gopkg.in/cheggaaa/pb.v1"
"gopkg.in/cheggaaa/pb.v2"
)

func pruneCommandFactory() (cli.Command, error) {
Expand Down Expand Up @@ -187,7 +187,9 @@ func searchObjects(svc *s3.S3, bucket string, region string, prefix string, maxF
if (len(allObjs) + len(p.Contents)) > maxFiles {
size = maxFiles - len(allObjs)
}
bar = pb.StartNew(size).Prefix(fmt.Sprintf(" page %d:", i))
bar = pb.ProgressBarTemplate(fmt.Sprintf(`{{ blue " page %d: " }} {{bar . "[" "=" ">" "_" "]" | green}} {{counters . | blue}}`, i)).Start(size)
defer bar.Finish()
bar.Set("prefix", fmt.Sprintf(" page %d: ", i))
}

for _, obj := range p.Contents {
Expand Down Expand Up @@ -215,10 +217,6 @@ func searchObjects(svc *s3.S3, bucket string, region string, prefix string, maxF
}
}

if showProgress {
bar.Finish()
}

return true
})

Expand Down

0 comments on commit c039b75

Please sign in to comment.