asimov-host-module 0.0.1

ASIMOV module for information about the current host.
Documentation
// This is free and unencumbered software released into the public domain.

use whoami::{
    Language, arch,
    fallible::{devicename, distro, hostname, realname, username},
    langs,
};

fn main() -> std::io::Result<()> {
    println!(
        "The user's name is \"{}\" (username \"{}\").",
        realname()?,
        username()?
    );

    match langs().map(|iter| iter.collect::<Vec<Language>>()) {
        Err(_) => (),
        Ok(langs) if langs.is_empty() => (),
        Ok(langs) => {
            println!("The user's preferred languages are: {:?}", langs);
        }
    };

    println!(
        "The host's device name is \"{}\" (hostname \"{}\").",
        devicename()?,
        hostname()?
    );

    println!(
        "The host's operating system is \"{}\" (architecture \"{}\").",
        distro()?,
        arch(),
    );

    Ok(())
}