Skip to content

macOS/Windows version of treefetchΒ #8

@angelofallars

Description

@angelofallars

( 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> {
    ...
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions