commit ef77e503a69206439d7fa9b0bfe289417236af3d
parent 544a33d753d91e40ec760ffbf71efa216269b272
Author: Sean Enck <sean@ttypty.com>
Date: Wed, 19 Jan 2022 18:00:14 -0500
pad with 0
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/cmd/lb-totp/main.go b/cmd/lb-totp/main.go
@@ -117,7 +117,11 @@ func display(token string, clip, once, short bool) error {
startColor = redStart
endColor = redEnd
}
- expires := fmt.Sprintf("%s%s (%2d)%s", startColor, now.Format("15:04:05"), left, endColor)
+ leftString := fmt.Sprintf("%d", left)
+ if len(leftString) < 1 {
+ leftString = "0" + leftString
+ }
+ expires := fmt.Sprintf("%s%s (%s)%s", startColor, now.Format("15:04:05"), leftString, endColor)
outputs := []string{expires}
if !clip {
outputs = append(outputs, fmt.Sprintf("%s\n %s", tok, code))