Revert "fix(cli): use '> ' as readline prompt when project active"
This reverts commit 4d9399f737.
This commit is contained in:
@@ -38,15 +38,15 @@ pub fn build_prompt(in_multiline: bool, agent_name: Option<&str>, active_project
|
|||||||
.file_name()
|
.file_name()
|
||||||
.and_then(|n| n.to_str())
|
.and_then(|n| n.to_str())
|
||||||
.unwrap_or("project");
|
.unwrap_or("project");
|
||||||
// Return colored prefix (without "> "), and "> " as the readline prompt
|
// Return colored prefix to print, and plain prompt for readline
|
||||||
let prefix = format!(
|
let prefix = format!(
|
||||||
"{} {}| {}{}",
|
"{} {}| {}>{} ",
|
||||||
base_name,
|
base_name,
|
||||||
SetForegroundColor(Color::Blue),
|
SetForegroundColor(Color::Blue),
|
||||||
project_name,
|
project_name,
|
||||||
ResetColor
|
ResetColor
|
||||||
);
|
);
|
||||||
(prefix, "> ".to_string())
|
(prefix, String::new())
|
||||||
} else {
|
} else {
|
||||||
(String::new(), format!("{}> ", base_name))
|
(String::new(), format!("{}> ", base_name))
|
||||||
}
|
}
|
||||||
@@ -377,11 +377,11 @@ mod tests {
|
|||||||
fn test_build_prompt_with_project() {
|
fn test_build_prompt_with_project() {
|
||||||
let project = Some(create_test_project("myapp"));
|
let project = Some(create_test_project("myapp"));
|
||||||
let (prefix, prompt) = build_prompt(false, None, &project);
|
let (prefix, prompt) = build_prompt(false, None, &project);
|
||||||
// Project name should be in the colored prefix, prompt should be "> "
|
// Project name should be in the colored prefix, prompt should be empty
|
||||||
assert!(prefix.contains("g3"));
|
assert!(prefix.contains("g3"));
|
||||||
assert!(prefix.contains("myapp"));
|
assert!(prefix.contains("myapp"));
|
||||||
assert!(prefix.contains("|"));
|
assert!(prefix.contains("|"));
|
||||||
assert_eq!(prompt, "> ");
|
assert!(prompt.is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -392,7 +392,7 @@ mod tests {
|
|||||||
assert!(prefix.contains("carmack"));
|
assert!(prefix.contains("carmack"));
|
||||||
assert!(prefix.contains("myapp"));
|
assert!(prefix.contains("myapp"));
|
||||||
assert!(prefix.contains("|"));
|
assert!(prefix.contains("|"));
|
||||||
assert_eq!(prompt, "> ");
|
assert!(prompt.is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -418,7 +418,7 @@ mod tests {
|
|||||||
});
|
});
|
||||||
let (prefix, prompt) = build_prompt(false, None, &project);
|
let (prefix, prompt) = build_prompt(false, None, &project);
|
||||||
assert!(prefix.contains("awesome-app"));
|
assert!(prefix.contains("awesome-app"));
|
||||||
assert_eq!(prompt, "> ");
|
assert!(prompt.is_empty());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user