mirror of
https://github.com/NotAShelf/microfetch.git
synced 2024-11-01 14:51:14 +00:00
trim shell name to omit store path
This commit is contained in:
parent
fc62d72cab
commit
e3112dba1d
1 changed files with 3 additions and 6 deletions
|
@ -15,13 +15,10 @@ pub fn get_username_and_hostname() -> Result<String, io::Error> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_shell() -> Result<String, io::Error> {
|
pub fn get_shell() -> Result<String, io::Error> {
|
||||||
// In some setups, $SHELL is set to the store path
|
let shell_path = env::var("SHELL").unwrap_or_else(|_| "unknown_shell".to_string());
|
||||||
// of the actual shell program. While we can consider
|
let shell_name = shell_path.rsplit('/').next().unwrap_or("unknown_shell");
|
||||||
// trimming by name, I will leave it to the user to handle
|
|
||||||
// what their SHELL variable is really set to.
|
|
||||||
let shell = env::var("SHELL").unwrap_or_else(|_| "unknown_shell".to_string());
|
|
||||||
|
|
||||||
Ok(shell)
|
Ok(shell_name.to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_root_disk_usage() -> Result<String, io::Error> {
|
pub fn get_root_disk_usage() -> Result<String, io::Error> {
|
||||||
|
|
Loading…
Reference in a new issue