Skip to content
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

Change output to minutes and seconds ? #48

Open
aindriu80 opened this issue Jun 27, 2023 · 3 comments
Open

Change output to minutes and seconds ? #48

aindriu80 opened this issue Jun 27, 2023 · 3 comments

Comments

@aindriu80
Copy link

Very nice plugin

Can you change the default behaviour that reports in seconds to minutes and seconds?

@MichaelAquilina
Copy link
Owner

Thanks :)

Unless there is an easy way to convert this via a very standard command line utility, its unlikely I'll implement this in bash as it would be quite cumbersome.

If you or someone in the community is aware of an easy way to do that, then I'm happy to accept a PR or just a recommendation for me to look into!

@arvyanh
Copy link

arvyanh commented Feb 5, 2024

If we don't care about hours, I think something like echo $((155/60)) $((155%60)) should be enough. (155 is the seconds)

@qin-ziliang
Copy link

qin-ziliang commented Jun 13, 2024

I am not familiar with shell language, but through the @arvyanh reminder, I changed the function _auto_notify_message() and simply realized the function of displaying hours and minutes.

function _auto_notify_message() {
    local command="$1"
    local elapsed="$(($2/3600))h $((($2%3600)/60))m $(($2%60))s ⏳️"
    local exit_code="$3"
    local platform="$(uname)"
    # Run using echo -e in order to make sure notify-send picks up new line
    local DEFAULT_TITLE="\"%command\" Completed ✅"
    local DEFAULT_BODY="$(echo -e "Total time: %elapsed\nExit code: %exit_code ♻️")"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants