From 58ed23913dbc4c9bad97f657d45d5b6e06652a42 Mon Sep 17 00:00:00 2001 From: Colin Caine Date: Thu, 9 Nov 2017 05:37:23 +0000 Subject: [PATCH] exmode: Give build-time error on bad arg types --- scripts/excmds_macros.py | 2 ++ src/parsers/exmode.ts | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/excmds_macros.py b/scripts/excmds_macros.py index 1bcd9a57..07a94148 100755 --- a/scripts/excmds_macros.py +++ b/scripts/excmds_macros.py @@ -38,6 +38,8 @@ class Signature: # Type declaration if ':' in param: name, typ = map(str.strip, param.split(':')) + if typ not in ('number', 'boolean', 'string', 'string[]', 'ModeName') and '|' not in typ: + raise Exception("Edit me! " + typ + " is not a supported type!") # Default argument elif '=' in param: name, default = map(str.strip, param.split('=')) diff --git a/src/parsers/exmode.ts b/src/parsers/exmode.ts index 421a3b8a..8a4c515f 100644 --- a/src/parsers/exmode.ts +++ b/src/parsers/exmode.ts @@ -17,7 +17,8 @@ function convertArgs(params, argv) { const conversions = { number: convert.toNumber, boolean: convert.toBoolean, - string: (s)=>s, + string: s=>s, + ModeName: s=>s, } const typedArgs = []