feat(rawcli): colorized breadcrumb prompt
Color-code the prompt so the session state reads at a glance, using the trace formatter's palette so prompt and trace look like one UI: [ raw / hf / NTAG213 / 0x ] dim ^bold ^cyan ^bold-green ^yellow(hex) | magenta(binary) dim - bold `raw`; cyan RF field; bold-green identified transponder; entry mode yellow for hex, magenta for binary (so the base is obvious and flips color on Ctrl-/); dim brackets/separators. - session.colored_breadcrumb() returns the ANSI form; breadcrumb() stays plain (stripping the ANSI yields it — asserted). Prompt message renders it via ANSI(). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -46,6 +46,18 @@ class TestBreadcrumb:
|
||||
s.field = "lf"
|
||||
assert s.breadcrumb() == "[raw / lf / 0x]"
|
||||
|
||||
def test_colored_matches_plain(self):
|
||||
s = RawSession()
|
||||
s.field, s.transponder = "hf", "NTAG213"
|
||||
assert "\x1b[" in s.colored_breadcrumb() # actually colored
|
||||
assert _plain(s.colored_breadcrumb()) == s.breadcrumb() # same content, ANSI stripped
|
||||
|
||||
def test_colored_mode_color_changes(self):
|
||||
s = RawSession()
|
||||
hex_prompt = s.colored_breadcrumb()
|
||||
s.toggle_entry_mode()
|
||||
assert hex_prompt != s.colored_breadcrumb() # hex vs binary colored differently
|
||||
|
||||
|
||||
class TestTraceView:
|
||||
def test_command_and_response_lines(self):
|
||||
|
||||
Reference in New Issue
Block a user