# turnbase-cli - Complete API Documentation > Generic command-line runner for Turnbase games: headless play, self-play, and interactive play **Version:** 0.0.0 **Authors:** Matan Lurey **License:** MIT OR Apache-2.0 **Repository:** https://github.com/crates-lurey-io/turnbase **Keywords:** game-engine, turn-based, deterministic, gamedev, ai Generated: 2026-07-25 17:07:54 UTC Created by: [cargo-llms-txt](https://github.com/masinc/cargo-llms-txt) ## Table of Contents ### src/lib.rs - pub struct PlayArgs - impl PlayArgs - pub fn run - pub fn run_with_play - pub fn run_tui --- ## README.md ### turnbase-cli Generic command-line runner for Turnbase games: headless play, self-play, and interactive play Part of the [turnbase](https://github.com/crates-lurey-io/turnbase) workspace. --- ## src/lib.rs ### PlayArgs ```rust #[derive(Args)] pub struct PlayArgs { } ``` Arguments for the interactive `play` command, exposed so a game that passes its own `play` handler to [`run_with_play`] can read them. ### impl PlayArgs ```rust impl PlayArgs { pub fn seed(&self) -> Option; pub fn manual_seats(&self) -> Vec; } ``` ### run ```rust pub fn run(game: G) -> ExitCode where G: Game + Serialize + DeserializeOwned, G::State: Serialize + DeserializeOwned, G::Action: DeserializeOwned + Debug, G::View: Serialize ``` Runs the text/headless CLI for `game`: `new`, `query`, `act`, `self-play`, and a text `play`. Works for any game whose types are serde-serializable. ### run_with_play ```rust pub fn run_with_play(game: G, play: F) -> ExitCode where G: Game + Serialize + DeserializeOwned, G::State: Serialize + DeserializeOwned, G::Action: DeserializeOwned + Debug, G::View: Serialize, F: FnOnce ``` Like [`run`], but the game supplies its own interactive `play` handler (a bespoke UI, say) rather than the built-in text stepper. The headless `new`/`query`/`act` and `self-play` commands are handled here exactly as [`run`] does; only the interactive `play` command is delegated to `play`. This is how a game ships its own terminal UI (see `examples/blackjack`) without reimplementing the rest of the CLI. ### run_tui ```rust pub fn run_tui(game: G) -> ExitCode where G: PrintableGame + Clone + Serialize + DeserializeOwned, G::State: Clone + Serialize + DeserializeOwned, G::Action: Clone + DeserializeOwned + Debug, G::View: Serialize ``` Like [`run`], but `play` opens the retroglyph dashboard instead of the text stepper. Requires the game to implement [`PrintableGame`].