mirror of
https://github.com/openai/codex.git
synced 2026-11-28 07:32:19 +00:00
Fallback display names for TUI skill mentions (#18786)
This updates TUI skill mentions to show a fallback label when a skill does not define a display name, so unnamed skills remain understandable in the picker without changing behavior for skills that already have one. <img width="1028" height="198" alt="Screenshot 2026-04-20 at 6 25 15 PM" src="https://github.com/user-attachments/assets/84077b85-99d0-4db9-b533-37e1887b4506" />
This commit is contained in:
1 parent
1132ef887c
commit
2cc146f5ea
4 files changed
+18
-14
No files matched your search
@@ -5,12 +5,23 @@ 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
|
||||
pub(crate) fn skill_display_name(skill: &SkillMetadata) -> String {
|
||||
if let Some(display_name) = skill
|
||||
.interface
|
||||
.as_ref()
|
||||
.and_then(|interface| interface.display_name.as_deref())
|
||||
.unwrap_or(&skill.name)
|
||||
{
|
||||
return display_name.to_string();
|
||||
}
|
||||
|
||||
if let Some((plugin_name, skill_name)) = skill.name.split_once(':')
|
||||
&& !plugin_name.is_empty()
|
||||
&& !skill_name.is_empty()
|
||||
{
|
||||
return format!("{skill_name} ({plugin_name})");
|
||||
}
|
||||
|
||||
skill.name.clone()
|
||||
}
|
||||
|
||||
pub(crate) fn skill_description(skill: &SkillMetadata) -> &str {
|
||||
|
||||
Reference in new issue
Block a user