From b2f3bea6db7a79c2c969a5943100ff113f4d9b9e Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 18 Nov 2020 22:21:50 +0000 Subject: [PATCH] fix game names Signed-off-by: Ian Jackson --- src/bin/otter.rs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/bin/otter.rs b/src/bin/otter.rs index 09683820..1766c669 100644 --- a/src/bin/otter.rs +++ b/src/bin/otter.rs @@ -83,9 +83,21 @@ struct MainOpts { impl MainOpts { pub fn instance_name(&self, table_name: &str) -> InstanceName { - InstanceName { - account: self.gaccount.clone(), - game: table_name.into(), + match table_name.strip_prefix(":") { + Some(rest) => { + InstanceName { + account: self.gaccount.clone(), + game: rest.into(), + } + } + None => { + table_name.parse().unwrap_or_else(|e|{ + eprintln!( + "instance name must start with : or be valid full name: {}", + &e); + exit(EXIT_USAGE); + }) + } } } } -- 2.30.2