Skip to main content

execute_with

Function execute_with 

Source
pub async fn execute_with<S: TerminalSetup, E: EventSource>(
    control: ControlClient,
    setup: &mut S,
    events: &mut E,
    yank_fn: fn(&str) -> bool,
) -> Result<()>
Expand description

Load config, build the dashboard + engine, and run the event loop against the injected TerminalSetup and EventSource. This is the whole lev dash command minus the two real-terminal doubles - so it is fully unit-testable (drive it with TestSetup + a canned TestEventSource), and the binary’s real_dashboard supplies the real crossterm CrosstermSetup

The real terminal wiring cannot live here: constructing CrosstermSetup enables actual raw mode / the alternate screen and blocks forever on real keyboard input (an is_terminal() guard does not prevent the hang - it still hangs a real editor terminal full-screen). That irreducible sliver is the binary’s job; everything it composes is exercised here. yank_fn is the clipboard implementation the dashboard’s y keypress uses; the binary passes the real native-tool/OSC52 clipboard (which can write the real terminal), tests pass a no-op.