mirror of
https://github.com/openai/codex.git
synced 2026-05-02 04:11:39 +03:00
Remove the legacy TUI split (#15922)
This is the part 1 of 2 PRs that will delete the `tui` / `tui_app_server` split. This part simply deletes the existing `tui` directory and marks the `tui_app_server` feature flag as removed. I left the `tui_app_server` feature flag in place for now so its presence doesn't result in an error. It is simply ignored. Part 2 will rename the `tui_app_server` directory `tui`. I did this as two parts to reduce visible code churn.
This commit is contained in:
@@ -1,43 +0,0 @@
|
||||
use codex_core::skills::model::SkillMetadata;
|
||||
use codex_utils_fuzzy_match::fuzzy_match;
|
||||
|
||||
use crate::text_formatting::truncate_text;
|
||||
|
||||
pub(crate) const SKILL_NAME_TRUNCATE_LEN: usize = 21;
|
||||
|
||||
pub(crate) fn skill_display_name(skill: &SkillMetadata) -> &str {
|
||||
skill
|
||||
.interface
|
||||
.as_ref()
|
||||
.and_then(|interface| interface.display_name.as_deref())
|
||||
.unwrap_or(&skill.name)
|
||||
}
|
||||
|
||||
pub(crate) fn skill_description(skill: &SkillMetadata) -> &str {
|
||||
skill
|
||||
.interface
|
||||
.as_ref()
|
||||
.and_then(|interface| interface.short_description.as_deref())
|
||||
.or(skill.short_description.as_deref())
|
||||
.unwrap_or(&skill.description)
|
||||
}
|
||||
|
||||
pub(crate) fn truncate_skill_name(name: &str) -> String {
|
||||
truncate_text(name, SKILL_NAME_TRUNCATE_LEN)
|
||||
}
|
||||
|
||||
pub(crate) fn match_skill(
|
||||
filter: &str,
|
||||
display_name: &str,
|
||||
skill_name: &str,
|
||||
) -> Option<(Option<Vec<usize>>, i32)> {
|
||||
if let Some((indices, score)) = fuzzy_match(display_name, filter) {
|
||||
return Some((Some(indices), score));
|
||||
}
|
||||
if display_name != skill_name
|
||||
&& let Some((_indices, score)) = fuzzy_match(skill_name, filter)
|
||||
{
|
||||
return Some((None, score));
|
||||
}
|
||||
None
|
||||
}
|
||||
Reference in New Issue
Block a user