This commit is contained in:
Candifloss 2024-11-29 16:38:19 +05:30
parent e8216e7c08
commit 309021fb68
2 changed files with 4 additions and 5 deletions

View File

@ -28,10 +28,10 @@ pub fn info() -> Option<(String, String)> {
pub fn repo_name(path: &str) -> String {
Path::new(path)
.file_name()
.and_then(|name| name.to_str())
.unwrap_or("") // Default value if None
.to_string() // Convert &str to String
.file_name() // Extracts the last component of the path.
.and_then(|name| name.to_str()) // Converts the `OsStr` to `&str`.
.unwrap_or("") // Default value(empty string) if None(no valid name)
.to_string() // Converts &str to String
}
//Git branch indicator

View File

@ -46,7 +46,6 @@ fn main() {
components.push(user::indicator());
}
if indicate_err {
//components.push(error::indicator(cmd_args));
components.push(error::indicator(&cmd_args));
}
if show_pwd {