From f07221b4e1d8aa464a44fe566884ccc0565406e9 Mon Sep 17 00:00:00 2001 From: salmonik Date: Sun, 1 Nov 2026 16:17:19 +0100 Subject: v3.2.0: straight and split bets anywhere on the felt; add history command --- src/client/ui.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/client/ui.rs') diff --git a/src/client/ui.rs b/src/client/ui.rs index e7f510b..bb5b55f 100644 --- a/src/client/ui.rs +++ b/src/client/ui.rs @@ -80,6 +80,11 @@ const COMMANDS: &[CommandHelp] = &[ usage: "hosts", description: "list remembered hosts", }, + CommandHelp { + name: "history", + usage: "history [count]", + description: "show your recent wins and losses", + }, CommandHelp { name: "quit", usage: "quit", @@ -267,6 +272,30 @@ pub fn terminal_size_warning(columns: u16, rows: u16) -> Option { )) } +/// One line per settled play, newest first. +pub fn history_lines(records: &[crate::history::PlayRecord]) -> Vec { + if records.is_empty() { + return vec!["No plays recorded yet.".to_string()]; + } + + let mut lines = vec![ + format!("Recent plays ({}):", records.len()), + " when game bet won balance result".to_string(), + ]; + for record in records { + lines.push(format!( + " {:<16} {:<8} {:>6} {:>6} {:>7} {}", + record.short_time(), + record.game, + record.bet, + record.winnings, + record.balance_after, + record.summary() + )); + } + lines +} + /// Render remembered hosts. /// /// Two addresses that present the same certificate key are the same server, so -- cgit v1.2.3