Skip to main content

Module control

Module control 

Source
Expand description

Optional Unix-socket control plane. When ebman is launched with --control-socket PATH, this module opens a listener at PATH and accepts one-shot requests:

  • SCREEN\n → returns a plain-text rendering of the current TUI frame.
  • KEY <SPEC>\n → injects a synthesised key event into the run loop. Spec syntax: Down, Up, Enter, Esc, Tab, BackTab, Backspace, Home, End, PageUp, PageDown, Space, F1F12, a single character, or Char(j). Combine with Ctrl+, Shift+, Alt+.
  • CMD <text>\n → runs the given :command (leading colon optional).
  • STATE\n → returns a flat JSON object with current mode / profile / region / env count / selected env / load state.

Each TCP connection is a single request → response → close cycle, so the ebman ctl … subcommand can stay stateless (and so the server is robust against half-disconnected clients).

Security: the listener creates the socket with 0600 permissions so only the current user can connect. Anyone with read access to that socket has full control of the running ebman process, including dispatch of destructive AWS actions — keep the socket path private.

Enums§

ControlOp
One request received over the control socket. The main run loop drains these from an mpsc channel and dispatches them inside tokio::select!.

Functions§

default_socket_path
Default control-socket path if the user doesn’t pass one explicitly. ~/.cache/ebman/control.sock. The ebman ctl subcommand uses the same default so the two halves rendezvous without any flag.
parse_key_spec
Parse a key spec into a crossterm KeyEvent. See the module-level docs for the grammar. Returns None if no terminal key code could be parsed.
render_buffer_as_text
Render a ratatui Buffer to plain text by walking its cells row by row. Trailing whitespace per line is stripped so the output is grep-friendly.
spawn_listener
Open the Unix socket at path and spawn a listener task that translates inbound text requests into ControlOp messages on tx. Silently returns on bind failure after logging the error — the TUI must keep running.