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

macOS/Windows version of treefetch #8

Open
angelofallars opened this issue Jan 16, 2022 · 3 comments
Open

macOS/Windows version of treefetch #8

angelofallars opened this issue Jan 16, 2022 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed linux macos rust windows

Comments

@angelofallars
Copy link
Owner

( Help wanted )

treefetch in its current state only supports Linux. Use Rust conditional compilation in the fields.rs file to write separate code for each OS; Windows and macOS. You may also modify the main.rs a bit if needed.

The fetch information you need to implement for either Windows or macOS are:

  • username / hostname
  • OS name
  • kernel (if applicable)
  • Shell name
  • Uptime
  • Memory usage

You can make a PR implementing only Windows or only macOS support for now if you want.

I suggest doing something like this:

#[cfg(target_os = "linux")]
pub fn get_memory() -> Result<String, String> {
    ...
}

#[cfg(target_os = "macos")]
pub fn get_memory() -> Result<String, String> {
    ...
}

#[cfg(target_os = "windows")]
pub fn get_memory() -> Result<String, String> {
    ...
}
@angelofallars angelofallars added enhancement New feature or request help wanted Extra attention is needed rust macos windows linux labels Jan 16, 2022
@EdenQwQ
Copy link
Contributor

EdenQwQ commented Jan 20, 2022

Check these two out: whoami sysinfo.
They both support multiple platforms.

@valpackett
Copy link
Contributor

Hi, I'm the author of systemstat, would you accept a PR that uses systemstat for uptime and memory and adds more things systemstat supports (such as battery percentage and disk usage)?

@angelofallars
Copy link
Owner Author

Hi, I'm the author of systemstat, would you accept a PR that uses systemstat for uptime and memory and adds more things systemstat supports (such as battery percentage and disk usage)?

@unrelentingtech Sure! I'd love to see how you would implement this in treefetch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed linux macos rust windows
Projects
None yet
Development

No branches or pull requests

3 participants