-
Notifications
You must be signed in to change notification settings - Fork 443
feat: Adding --show-elapsed flag in spin command #953
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| return fmt.Sprintf("(%dm %ds)", minutes, seconds) | ||
| } | ||
| return fmt.Sprintf("(%ds)", seconds) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this provide enough additional value over plain Sprintf? 🤔
fmt.Sprintf("duration: %s", d)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean showing only the seconds? or formatting time.Now()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I mean formatting the duration. I realize we should round, but this:
var start = time.Now()
for true {
time.Sleep(100 * time.Millisecond)
fmt.Printf("%s\n", time.Since(start).Round(100*time.Millisecond))
}creates output like
59.6s
59.7s
59.9s
1m0s
1m0.1s
1m0.2s
1m0.3s
Which is basically what you propose, sans the spaces. Hence my question, if you think the visual difference justifies the additional code.
(Not my call, just a thought.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was not aware of this format specifier.
I would say since Gum is reliant on being User Friendly and good looking.
a 10 line function would justify it. I could make the formatting better too, if you have something in mind.
Its up to you though. So let me know and Ill change it.
Fixes #951
Changes
These are the formats