Skip to content

refactor(cli): named ANSI constants and shared auth frame - #167

Merged
kacy merged 1 commit into
mainfrom
refactor/idiomatic-rust-pass-pr5
Feb 17, 2026
Merged

refactor(cli): named ANSI constants and shared auth frame#167
kacy merged 1 commit into
mainfrom
refactor/idiomatic-rust-pass-pr5

Conversation

@kacy

@kacy kacy commented Feb 17, 2026

Copy link
Copy Markdown
Owner

summary

two small cleanups in the CLI crate:

ANSI escape constantsrepl.rs had raw \x1b[...] strings scattered through the Highlighter impl and highlight_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_frame helperconnection.rs and bench_conn.rs each built the same Frame::Array(["AUTH", password]) independently. extracted pub fn auth_frame(password: &str) -> Frame in connection.rs and updated both Connection::authenticate and BenchConnection::authenticate to use it.

what was tested

  • cargo build -p emberkv-cli — clean
  • cargo test -p emberkv-cli — 84/84 pass (all existing highlight and tokenize tests still pass)
  • cargo clippy -p emberkv-cli -- -D warnings — zero warnings
  • cargo fmt -p emberkv-cli --check — clean

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
kacy merged commit ecd7d63 into main Feb 17, 2026
7 checks passed
@kacy
kacy deleted the refactor/idiomatic-rust-pass-pr5 branch February 17, 2026 23:43
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant