mirror of
https://github.com/NotAShelf/microfetch.git
synced 2024-11-01 14:51:14 +00:00
Shut up, clippy.
This commit is contained in:
parent
13903539b7
commit
927f6077b4
1 changed files with 39 additions and 33 deletions
72
src/main.rs
72
src/main.rs
|
@ -16,43 +16,40 @@ use nix::sys::sysinfo::sysinfo;
|
||||||
fn main() -> Result<(), Report> {
|
fn main() -> Result<(), Report> {
|
||||||
color_eyre::install()?;
|
color_eyre::install()?;
|
||||||
|
|
||||||
let user_info = get_username_and_hostname()?;
|
let fields = Fields {
|
||||||
let os_name = get_os_pretty_name()?;
|
user_info: get_username_and_hostname()?,
|
||||||
let kernel_version = get_system_info()?;
|
os_name: get_os_pretty_name()?,
|
||||||
let shell = get_shell()?;
|
kernel_version: get_system_info()?,
|
||||||
let uptime = get_current()?;
|
shell: get_shell()?,
|
||||||
let window_manager = get_desktop_info()?;
|
uptime: get_current()?,
|
||||||
let sys_info = sysinfo()?;
|
window_manager: get_desktop_info()?,
|
||||||
let memory_usage = get_memory_usage(sys_info);
|
memory_usage: get_memory_usage(sysinfo()?),
|
||||||
let storage = get_root_disk_usage()?;
|
storage: get_root_disk_usage()?,
|
||||||
let colors = print_dots()?;
|
colors: print_dots()?,
|
||||||
|
};
|
||||||
|
|
||||||
print_system_info(
|
print_system_info(&fields);
|
||||||
&user_info,
|
|
||||||
&os_name,
|
|
||||||
&kernel_version,
|
|
||||||
&shell,
|
|
||||||
&uptime,
|
|
||||||
&window_manager,
|
|
||||||
&memory_usage,
|
|
||||||
&storage,
|
|
||||||
&colors,
|
|
||||||
);
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_system_info(
|
// Struct to hold all the fields we need to print
|
||||||
user_info: &str,
|
// helps avoid clippy warnings about argument count
|
||||||
os_name: &str,
|
// and makes it easier to pass around, though its
|
||||||
kernel_version: &str,
|
// not like we need to
|
||||||
shell: &str,
|
struct Fields {
|
||||||
uptime: &str,
|
user_info: String,
|
||||||
window_manager: &str,
|
os_name: String,
|
||||||
memory_usage: &str,
|
kernel_version: String,
|
||||||
storage: &str,
|
shell: String,
|
||||||
colors: &str,
|
uptime: String,
|
||||||
) {
|
window_manager: String,
|
||||||
|
memory_usage: String,
|
||||||
|
storage: String,
|
||||||
|
colors: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn print_system_info(fields: &Fields) {
|
||||||
println!(
|
println!(
|
||||||
"
|
"
|
||||||
{CYAN} ▟█▖ {BLUE}▝█▙ ▗█▛ {user_info} ~{RESET}
|
{CYAN} ▟█▖ {BLUE}▝█▙ ▗█▛ {user_info} ~{RESET}
|
||||||
|
@ -64,6 +61,15 @@ fn print_system_info(
|
||||||
{BLUE} ▝█▛ {CYAN}██▖{BLUE}▗▄▄▄▄▄▄▄▄▄▄▄ {CYAN} {BLUE}Memory{RESET} {memory_usage}
|
{BLUE} ▝█▛ {CYAN}██▖{BLUE}▗▄▄▄▄▄▄▄▄▄▄▄ {CYAN} {BLUE}Memory{RESET} {memory_usage}
|
||||||
{BLUE} ▝ {CYAN}▟█▜█▖{BLUE}▀▀▀▀▀██▛▀▀▘ {CYAN} {BLUE}Storage (/){RESET} {storage}
|
{BLUE} ▝ {CYAN}▟█▜█▖{BLUE}▀▀▀▀▀██▛▀▀▘ {CYAN} {BLUE}Storage (/){RESET} {storage}
|
||||||
{CYAN} ▟█▘ ▜█▖ {BLUE}▝█▛ {CYAN} {BLUE}Colors{RESET} {colors}
|
{CYAN} ▟█▘ ▜█▖ {BLUE}▝█▛ {CYAN} {BLUE}Colors{RESET} {colors}
|
||||||
"
|
",
|
||||||
|
user_info = fields.user_info,
|
||||||
|
os_name = fields.os_name,
|
||||||
|
kernel_version = fields.kernel_version,
|
||||||
|
shell = fields.shell,
|
||||||
|
uptime = fields.uptime,
|
||||||
|
window_manager = fields.window_manager,
|
||||||
|
memory_usage = fields.memory_usage,
|
||||||
|
storage = fields.storage,
|
||||||
|
colors = fields.colors,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue