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

View File

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