aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/data.rs')
-rw-r--r--src/data.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/data.rs b/src/data.rs
index c2ea49e..ae89c9d 100644
--- a/src/data.rs
+++ b/src/data.rs
@@ -57,7 +57,8 @@ pub fn collect(opts: args::CommandLineOptions) -> PromptData {
}
fn hostname() -> Option<String> {
- if let Some(mut name) = hostname::get_hostname() {
+ if let Ok(name) = hostname::get() {
+ let mut name = name.into_string().unwrap();
if let Some(idx) = name.find('.') {
name.truncate(idx);
}
@@ -84,7 +85,7 @@ fn home() -> Option<std::path::PathBuf> {
}
fn user() -> Option<String> {
- users::get_current_username()
+ users::get_current_username().map(|s| s.into_string().unwrap())
}
fn is_root() -> bool {