Skip to content

feat: CLI watch mode, batch mode, and proto-ts stub - #298

Merged
kacy merged 2 commits into
mainfrom
feat/cli-watch-batch
Feb 25, 2026
Merged

feat: CLI watch mode, batch mode, and proto-ts stub#298
kacy merged 2 commits into
mainfrom
feat/cli-watch-batch

Conversation

@kacy

@kacy kacy commented Feb 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • ember-cli watch <key> [interval_ms] polls a key every N milliseconds and prints the value whenever it changes. Exits cleanly on ctrl-c using a pinned signal future so the handler is only registered once
  • Batch mode activates automatically when stdin is not a TTY (e.g. ember-cli < commands.txt). Blank lines and # comments are skipped, making it friendly for scripted input
  • Added proto-ts to the Makefile with a stub target that prints the TypeScript gRPC codegen command to run once clients/ember-ts/ exists

What was tested

  • cargo build -p emberkv-cli passes clean
  • cargo clippy -p emberkv-cli -- -D warnings passes with zero warnings
  • Watch mode compiles correctly with tokio::select! biased toward ctrl-c shutdown
  • Batch mode uses std::io::IsTerminal (stable since Rust 1.70) for TTY detection

Design considerations

  • Watch prints only on value change to avoid flooding logs during quiet periods
  • The ctrl-c future is pinned outside the loop so it can be polled repeatedly without re-registering the OS signal handler each iteration
  • Batch mode treats #-prefixed lines as comments for readability in script files

@kacy
kacy merged commit 6cdf58e into main Feb 25, 2026
@kacy
kacy deleted the feat/cli-watch-batch branch February 25, 2026 15:47
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