summaryrefslogtreecommitdiffstats
path: root/src/client/ui.rs
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-01 19:19:49 +0100
committersalmonik <salmonik@tuta.io>2026-11-01 19:19:49 +0100
commit24e3bb54db579fb9aad8df2a591527dc77fe4cb4 (patch)
treeaf9a0c290f2675068e8396823f641f24bbe4d308 /src/client/ui.rs
parentv4.0.6: move the prompt editor and key mapping out of the core (diff)
downloadzagan-bet-24e3bb54db579fb9aad8df2a591527dc77fe4cb4.tar.gz
zagan-bet-24e3bb54db579fb9aad8df2a591527dc77fe4cb4.zip
v4.0.7: finish the Phase 1 boundary with a command shell
The terminal command line moves to client::shell: a typed line becomes a core Command or an adapter action (connect, login, register, set-credential, host maintenance). ClientCore loses submit_line and the last TUI-shaped effects (Interactive, SetPrompt, ListHosts, ForgetHost, AnimateRoulette); the adapter animates roulette from the Result view. Adds forget-login, which drops the stored credential for the pinned key and keeps trust, distinct from logout (session only) and forget-host (trust too).
Diffstat (limited to '')
-rw-r--r--src/client/ui.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/client/ui.rs b/src/client/ui.rs
index bb5b55f..7439e0f 100644
--- a/src/client/ui.rs
+++ b/src/client/ui.rs
@@ -76,6 +76,11 @@ const COMMANDS: &[CommandHelp] = &[
76 description: "clear trust for one address (credentials stay while the key is in use)", 76 description: "clear trust for one address (credentials stay while the key is in use)",
77 }, 77 },
78 CommandHelp { 78 CommandHelp {
79 name: "forget-login",
80 usage: "forget-login [ip:port]",
81 description: "forget the saved login (trust is kept)",
82 },
83 CommandHelp {
79 name: "hosts", 84 name: "hosts",
80 usage: "hosts", 85 usage: "hosts",
81 description: "list remembered hosts", 86 description: "list remembered hosts",
@@ -272,6 +277,15 @@ pub fn terminal_size_warning(columns: u16, rows: u16) -> Option<String> {
272 )) 277 ))
273} 278}
274 279
280/// List of games for the terminal's `games` command.
281pub fn game_lines(games: &[(String, String)]) -> Vec<String> {
282 let mut lines = vec!["Available games:".to_string()];
283 for (game, name) in games {
284 lines.push(format!(" - {game} ({name})"));
285 }
286 lines
287}
288
275/// One line per settled play, newest first. 289/// One line per settled play, newest first.
276pub fn history_lines(records: &[crate::history::PlayRecord]) -> Vec<String> { 290pub fn history_lines(records: &[crate::history::PlayRecord]) -> Vec<String> {
277 if records.is_empty() { 291 if records.is_empty() {