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

w: GNU w output header includes output from uptime #60

Open
aliwithay opened this issue Apr 17, 2024 · 4 comments
Open

w: GNU w output header includes output from uptime #60

aliwithay opened this issue Apr 17, 2024 · 4 comments
Labels

Comments

@aliwithay
Copy link

aliwithay commented Apr 17, 2024

The header in GNU version contains the output from uptime as part of the header.

 15:12:54 up  5:47,  1 user,  load average: 0.68, 0.61, 0.74
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT

coreutils already has an implementation for uptime so the code for this already exists.

@aliwithay
Copy link
Author

Wondering if the best way to handle this would be to duplicate the code from uptime, or is there a way to call the coreutils implementation somehow?

@cakebaker
Copy link
Contributor

uptime is a crate on its own (https://crates.io/crates/uu_uptime), so, at least theoretically, it should be possible to reuse it in this way in w.

@sylvestre
Copy link
Contributor

or move the critical functions into uucore
https://docs.rs/uucore/latest/uucore/

@aliwithay
Copy link
Author

Thanks for the suggestions. Most of the functions are simply formatting functions which probably don't need to be in uucore. I think using the uptime crate might be okay for this. I will take a look into it.

@cakebaker cakebaker added the w label Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants