Skip to content

Commit

Permalink
feat: hide output if shrunk by 0 bytes unless --verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
martinlindhe committed Jan 17, 2024
1 parent 9119004 commit d7c3827
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ func main() {

diffSize := inFileSize - outFileSize
pctShrunk := 100 - ((float64(outFileSize) / float64(inFileSize)) * 100)
fmt.Printf("%s: %d -> %d (shrunk by %d bytes, %0.1f%%)",
*inFile, inFileSize, outFileSize, diffSize, pctShrunk)
fmt.Println()
if diffSize > 0 || *verbose {
fmt.Printf("%s: %d -> %d (shrunk by %d bytes, %0.1f%%)",
*inFile, inFileSize, outFileSize, diffSize, pctShrunk)
fmt.Println()
}
}

func pngcrushCompress(file string) error {
Expand Down

0 comments on commit d7c3827

Please sign in to comment.