MCPcopy
hub / github.com/wtfutil/wtf / formatPercent

Method formatPercent

modules/progress/widget.go:207–218  ·  view source on GitHub ↗
(p float64)

Source from the content-addressed store, hash-verified

205}
206
207func (widget *Widget) formatPercent(p float64) string {
208 switch widget.settings.showPercentage {
209 case "left":
210 return fmt.Sprintf("%.0f%% ", p*100)
211 case "right":
212 return fmt.Sprintf(" %.0f%%", p*100)
213 case "none":
214 return ""
215 default:
216 return fmt.Sprintf("%.0f%%", p*100)
217 }
218}
219
220func (widget *Widget) calcBarWidth(percent string) int {
221 _, _, width, _ := widget.View.GetInnerRect()

Callers 2

contentMethod · 0.95
displayMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected