refactor(cli): named ANSI constants and shared auth frame - #167
Merged
Conversation
replace inline \x1b escape strings in repl.rs with named constants (RESET, GREEN, RED, BOLD_CYAN, DIM) so color changes require updating one place rather than grep-and-replace. extract auth_frame() in connection.rs as the single definition of the AUTH wire frame. bench_conn.authenticate() now delegates to it instead of building the frame independently. authenticate() in Connection also uses it directly.
kacy
added a commit
that referenced
this pull request
Feb 19, 2026
replace inline \x1b escape strings in repl.rs with named constants (RESET, GREEN, RED, BOLD_CYAN, DIM) so color changes require updating one place rather than grep-and-replace. extract auth_frame() in connection.rs as the single definition of the AUTH wire frame. bench_conn.authenticate() now delegates to it instead of building the frame independently. authenticate() in Connection also uses it directly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
summary
two small cleanups in the CLI crate:
ANSI escape constants —
repl.rshad raw\x1b[...]strings scattered through theHighlighterimpl andhighlight_quotes. defined five named constants (RESET,GREEN,RED,BOLD_CYAN,DIM) at the top of the module and replaced all inline escapes. a future color change now requires editing one line.shared
auth_framehelper —connection.rsandbench_conn.rseach built the sameFrame::Array(["AUTH", password])independently. extractedpub fn auth_frame(password: &str) -> Frameinconnection.rsand updated bothConnection::authenticateandBenchConnection::authenticateto use it.what was tested
cargo build -p emberkv-cli— cleancargo test -p emberkv-cli— 84/84 pass (all existing highlight and tokenize tests still pass)cargo clippy -p emberkv-cli -- -D warnings— zero warningscargo fmt -p emberkv-cli --check— clean