Skip to content

Commit

Permalink
more meaningful output
Browse files Browse the repository at this point in the history
  • Loading branch information
jreisinger committed Mar 21, 2023
1 parent ed242cc commit 03470f3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
$ ghrel -l -p '*linux*' jreisinger/ghrel
Asset Updated Size Download count
----- ------- ---- --------------
ghrel_0.6.0_linux_386.tar.gz 2023-03-21 2031247 2
ghrel_0.6.0_linux_amd64.tar.gz 2023-03-21 2144185 2
ghrel_0.6.0_linux_arm64.tar.gz 2023-03-21 1974932 2
ghrel_0.6.0_linux_armv6.tar.gz 2023-03-21 2009336 2
ghrel_0.6.0_linux_386.tar.gz 2023-03-21 2031247 6
ghrel_0.6.0_linux_amd64.tar.gz 2023-03-21 2144185 7
ghrel_0.6.0_linux_arm64.tar.gz 2023-03-21 1974932 5
ghrel_0.6.0_linux_armv6.tar.gz 2023-03-21 2009336 7

$ ghrel -p '*linux*' jreisinger/ghrel
downloaded 5 file(s)
verified 4 file(s)
downloaded 4 (+ 1 checksums file)
verified 4
```

To use ghrel, download a [binary](https://github.com/jreisinger/ghrel/releases) for your system and architecture. Or `go install github.com/jreisinger/ghrel@latest`.
To use ghrel, download a [binary](https://github.com/jreisinger/ghrel/releases) for your system and architecture or `go install github.com/jreisinger/ghrel@latest`.
11 changes: 6 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func main() {
return
}

var checksumFiles []string
var checksumsFiles []string
var count struct {
mu sync.Mutex
files int
Expand All @@ -75,7 +75,7 @@ func main() {
}

if isChecksumsFile(file) {
checksumFiles = append(checksumFiles, file)
checksumsFiles = append(checksumsFiles, file)
} else if *pattern != "" {
matched, err := filepath.Match(*pattern, file)
if err != nil {
Expand All @@ -98,10 +98,11 @@ func main() {
}
wg.Wait()

fmt.Printf("downloaded %d file(s)\n", count.files)
fmt.Printf("downloaded\t%d (+ %d checksums file)\n",
count.files-len(checksumsFiles), len(checksumsFiles))

var verifiedFiles int
for _, c := range checksumFiles {
for _, c := range checksumsFiles {
checksums, err := verifyChecksums(c)
if err != nil {
log.Fatalf("%s: %v", c, err)
Expand All @@ -114,5 +115,5 @@ func main() {
}
}
}
fmt.Printf("verified %d file(s)\n", verifiedFiles)
fmt.Printf("verified\t%d\n", verifiedFiles)
}

0 comments on commit 03470f3

Please sign in to comment.