From f1878e73c2892da9b929a11c2ee805d9b46f7e6b Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 9 Dec 2021 18:38:05 -0500 Subject: this doesn't need to be modifiable --- src/env.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/env.rs') diff --git a/src/env.rs b/src/env.rs index 676b20e..b3a38c6 100644 --- a/src/env.rs +++ b/src/env.rs @@ -15,6 +15,14 @@ pub fn user() -> anyhow::Result { .into_owned()) } +pub fn prompt_char() -> anyhow::Result { + if users::get_current_uid() == 0 { + Ok("#".into()) + } else { + Ok("$".into()) + } +} + pub fn hostname() -> anyhow::Result { let mut hostname = hostname::get()?.to_string_lossy().into_owned(); if let Some(idx) = hostname.find('.') { -- cgit v1.2.3-54-g00ecf