(col *color.Color, msg string)
| 134 | } |
| 135 | |
| 136 | func (p *cliProgress) output(col *color.Color, msg string) { |
| 137 | p.outputMutex.Lock() |
| 138 | defer p.outputMutex.Unlock() |
| 139 | |
| 140 | hashedBytes := p.hashedBytes.Load() |
| 141 | cachedBytes := p.cachedBytes.Load() |
| 142 | uploadedBytes := p.uploadedBytes.Load() |
| 143 | cachedFiles := p.cachedFiles.Load() |
| 144 | inProgressHashing := p.inProgressHashing.Load() |
| 145 | hashedFiles := p.hashedFiles.Load() |
| 146 | ignoredErrorCount := p.ignoredErrorCount.Load() |
| 147 | fatalErrorCount := p.fatalErrorCount.Load() |
| 148 | |
| 149 | line := fmt.Sprintf( |
| 150 | " %v %v hashing, %v hashed (%v), %v cached (%v), uploaded %v", |
| 151 | p.spinnerCharacter(), |
| 152 | |
| 153 | inProgressHashing, |
| 154 | |
| 155 | hashedFiles, |
| 156 | units.BytesString(hashedBytes), |
| 157 | |
| 158 | cachedFiles, |
| 159 | units.BytesString(cachedBytes), |
| 160 | |
| 161 | units.BytesString(uploadedBytes), |
| 162 | ) |
| 163 | |
| 164 | if fatalErrorCount > 0 { |
| 165 | line += fmt.Sprintf(" (%v fatal errors)", fatalErrorCount) |
| 166 | } |
| 167 | |
| 168 | if ignoredErrorCount > 0 { |
| 169 | line += fmt.Sprintf(" (%v errors ignored)", ignoredErrorCount) |
| 170 | } |
| 171 | |
| 172 | if msg != "" { |
| 173 | prefix := "\n ! " |
| 174 | if !p.enableProgress { |
| 175 | prefix = "" |
| 176 | } |
| 177 | |
| 178 | col.Fprintf(p.out.stderr(), "%v%v", prefix, msg) //nolint:errcheck |
| 179 | } |
| 180 | |
| 181 | if !p.enableProgress { |
| 182 | return |
| 183 | } |
| 184 | |
| 185 | if est, ok := p.uploadStartTime.Estimate(float64(hashedBytes+cachedBytes), float64(p.estimatedTotalBytes)); ok { |
| 186 | line += fmt.Sprintf(", estimated %v", units.BytesString(p.estimatedTotalBytes)) |
| 187 | line += fmt.Sprintf(" (%.1f%%)", est.PercentComplete) |
| 188 | line += fmt.Sprintf(" %v left", est.Remaining) |
| 189 | } else { |
| 190 | line += ", estimating..." |
| 191 | } |
| 192 | |
| 193 | var extraSpaces string |
no test coverage detected