From fec230b04cd7500176428a1eb089889430e13185 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 22 Aug 2020 23:15:35 +0100 Subject: [PATCH] wip --- src/bin/otter.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/bin/otter.rs b/src/bin/otter.rs index 8fc2db41..c2c2dcb2 100644 --- a/src/bin/otter.rs +++ b/src/bin/otter.rs @@ -199,7 +199,9 @@ impl Conn { Fine | GamesList{..} => { }, AlterGame { error: None, .. } => { }, Error { error } => { - Err(error.clone()).context(format!("response to: {:?}",&cmd))?; + Err(error.clone()).context( + format!("got error response to: {:?}",&cmd) + )?; }, AlterGame { error: Some(error), .. } => { Err(error.clone()).context(format!( @@ -461,8 +463,19 @@ mod reset_game { how: MgmtGameUpdateMode::Bulk, }; let game : GameSpec = read_spec(&args.game_file, "game spec")?; + if let Some(table_file) = args.table_file { let table_spec = read_spec(&table_file, "table spec")?; + chan.cmd(&MgmtCommand::CreateGame { + name: args.name.clone(), + insns: vec![], + }).map(|_|()).or_else(|e| { + if let Some(&MgmtError::AlreadyExists) = e.downcast_ref() { + return Ok(()) + } + Err(e) + })?; + setup_table(&mut chan, &table_spec)?; } -- 2.30.2