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

Status: elapsed time in minutes, not humanize() #283

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

raphaelfournier
Copy link

@raphaelfournier raphaelfournier commented May 13, 2019

I worked on a widget for the AwesomeWM window manager (see my Github repo), which displays watson's status with an icon (if a frame is started, it's a "play" icon, if not it's a "stop" icon, like a music player), surrounded by a (partial) circle which is a (circular) progress bar (reaching the full circle after an hour).
2019-05-13-174115_3000x1920_scrot

I needed the value of the spent time in the frame, but parsing the result of "humanize()" (given by the status command) is not very convenient. I copied the current flag code and wrote a slightly different version, which outputs the duration with a single number, in minutes (which could then be tweaked in the widget to account for hours or days).

A better version would probably merge the -e and -m flag to allow a formatting string.

The `humanize()` function is not easy to parse, which is useful for
piping watson's status into other applications (e.g.: a AwesomeWM widget).
@jmaupetit jmaupetit self-requested a review May 17, 2019 17:26
@jmaupetit
Copy link
Contributor

A better version would probably merge the -e and -m flag to allow a formatting string.

Yep.

@0x7b1
Copy link

0x7b1 commented Jun 3, 2019

Hey man, did you find some clean solution to this? I also have this inconvenience in my polybar module

@raphaelfournier
Copy link
Author

Well, the solution that I propose is clean, even if it adds a new flag. So, for now, I think it could be accepted as is. Or, if I have to find time to merge -e and -m flags, it will have to wait a few weeks, probably.

@jmaupetit
Copy link
Contributor

We'll wait for it then 😉

@jmkerr
Copy link
Contributor

jmkerr commented Jul 9, 2019

It would be nice to have flags -h, -H, --human-readable, --no-human-readable in line with the rest of the interface and other tools. This flag would generalise better to other situations where, for example uuids are shortened for human consumption.

For maximum non-human-readability and other reasons, the time should be returned in seconds.

@raphaelfournier
Copy link
Author

raphaelfournier commented Jul 10, 2019

It would be nice to have flags -h, -H, --human-readable, --no-human-readable in line with the rest of the interface and other tools. This flag would generalise better to other situations where, for example uuids are shortened for human consumption.

You're right, it's a great idea. The -h flag may, however, conflict with -h, --help, we'll have to be careful.

For maximum non-human-readability and other reasons, the time should be returned in seconds.

You're right again, it was very hackish to have the time returned in minutes, seconds is way better.

Copy link
Contributor

@jmaupetit jmaupetit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only have few cosmetic changes, else 👏

raphaelfournier and others added 2 commits August 2, 2019 15:30
Small typo fixed.

Co-Authored-By: Julien Maupetit <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants