feat(cli): --demo demonstration mode flag + app plumbing (#22, ADR-0047 D1)
Add `--demo` (and the RDBMS_PLAYGROUND_DEMO env fallback) to enter demonstration mode, threaded onto App.demo_mode through run_loop — mirrors the --no-undo plumbing. Off by default, zero footprint when off. The --help line advertises only the visible keystroke badges; the Ctrl+] caption trigger is kept low-profile (ADR-0047 D6 updated). Phase A of ADR-0047; behaviour (badges/captions) lands in B and C.
This commit is contained in:
@@ -216,6 +216,9 @@ pub async fn run(args: Args) -> Result<()> {
|
||||
let db_existed = db_path.exists();
|
||||
// Undo is on unless `--no-undo` (ADR-0006 Amendment 1).
|
||||
let undo_enabled = !args.no_undo;
|
||||
// Demonstration mode under `--demo` / `RDBMS_PLAYGROUND_DEMO`
|
||||
// (ADR-0047). Off by default; threaded onto the `App` in run_loop.
|
||||
let demo_mode = args.demo;
|
||||
let database =
|
||||
Database::open_with_persistence_and_undo(db_path.as_path(), persistence, undo_enabled)
|
||||
.context("open database")?;
|
||||
@@ -273,6 +276,7 @@ pub async fn run(args: Args) -> Result<()> {
|
||||
initial_events,
|
||||
undo_enabled,
|
||||
resolved_mode,
|
||||
demo_mode,
|
||||
)
|
||||
.await;
|
||||
if let Err(e) = teardown_terminal(&mut terminal) {
|
||||
@@ -331,6 +335,7 @@ async fn run_loop(
|
||||
initial_events: Vec<AppEvent>,
|
||||
undo_enabled: bool,
|
||||
initial_mode: crate::mode::Mode,
|
||||
demo_mode: bool,
|
||||
) -> Result<Option<String>> {
|
||||
let (event_tx, mut event_rx) = mpsc::channel::<AppEvent>(EVENT_CHANNEL_CAPACITY);
|
||||
let reader_handle = spawn_event_reader(event_tx.clone());
|
||||
@@ -339,6 +344,8 @@ async fn run_loop(
|
||||
app.project_name = Some(project_display_name);
|
||||
app.project_is_temp = project_is_temp;
|
||||
app.undo_enabled = undo_enabled;
|
||||
// ADR-0047: enable the demo overlays for this session under `--demo`.
|
||||
app.demo_mode = demo_mode;
|
||||
// Start in the resolved input mode (ADR-0015 mode-restore
|
||||
// amendment, issue #14): `--mode` > stored project mode >
|
||||
// default. `Persistence` already carries the same value, so the
|
||||
|
||||
Reference in New Issue
Block a user