From: Ian Jackson Date: Sat, 22 Aug 2020 22:15:35 +0000 (+0100) Subject: wip X-Git-Tag: otter-0.2.0~1100 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=fec230b04cd7500176428a1eb089889430e13185;p=otter.git wip --- 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)?; }