Skip to content

Commit c25631a

Browse files
feat(cli): add highlight utility for entity names
1 parent d70b4f2 commit c25631a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

hatch/cli/cli_utils.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,32 @@ def _colors_enabled() -> bool:
221221
return True
222222

223223

224+
def highlight(text: str) -> str:
225+
"""Apply highlight formatting (bold + amber) to entity names.
226+
227+
Used in show commands to emphasize host and server names for
228+
quick visual scanning of detailed output.
229+
230+
Reference: R12 §3.3 (12-enhancing_colors_v0.md)
231+
Reference: R11 §3.2 (11-enhancing_show_command_v0.md)
232+
233+
Args:
234+
text: The entity name to highlight
235+
236+
Returns:
237+
str: Text with bold + amber formatting if colors enabled,
238+
otherwise plain text.
239+
240+
Example:
241+
>>> print(f"MCP Host: {highlight('claude-desktop')}")
242+
MCP Host: claude-desktop # (bold + amber in TTY)
243+
"""
244+
if _colors_enabled():
245+
# Bold (\033[1m) + Amber color
246+
return f"\033[1m{Color.AMBER.value}{text}{Color.RESET.value}"
247+
return text
248+
249+
224250
class ConsequenceType(Enum):
225251
"""Action types with dual-tense labels and semantic colors.
226252

0 commit comments

Comments
 (0)