diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-12-09 18:38:05 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-12-09 18:38:05 -0500 |
commit | f1878e73c2892da9b929a11c2ee805d9b46f7e6b (patch) | |
tree | 41758b3848e99a61abf1cfbd331e331d4eb224fc /src/env.rs | |
parent | c2c6adf5b755b33e6b844a502cd8d61eabf89126 (diff) | |
download | nbsh-f1878e73c2892da9b929a11c2ee805d9b46f7e6b.tar.gz nbsh-f1878e73c2892da9b929a11c2ee805d9b46f7e6b.zip |
this doesn't need to be modifiable
Diffstat (limited to 'src/env.rs')
-rw-r--r-- | src/env.rs | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -15,6 +15,14 @@ pub fn user() -> anyhow::Result<String> { .into_owned()) } +pub fn prompt_char() -> anyhow::Result<String> { + if users::get_current_uid() == 0 { + Ok("#".into()) + } else { + Ok("$".into()) + } +} + pub fn hostname() -> anyhow::Result<String> { let mut hostname = hostname::get()?.to_string_lossy().into_owned(); if let Some(idx) = hostname.find('.') { |