From 00a7290bf23a5463bc712610926470b2e5b15587 Mon Sep 17 00:00:00 2001 From: Philipp Muens Date: Wed, 13 Jul 2016 09:02:16 +0200 Subject: [PATCH] Reuse template array to produce readable list of available templates --- lib/plugins/create/create.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/plugins/create/create.js b/lib/plugins/create/create.js index b199afd7b..6523dc938 100644 --- a/lib/plugins/create/create.js +++ b/lib/plugins/create/create.js @@ -38,10 +38,13 @@ class Create { 'aws-python', ]; + const humanReadableTemplateList = `${validTemplates.slice(0, -1) + .join(', ')} and ${validTemplates.slice(-1)}`; + if (validTemplates.indexOf(this.options.template) === -1) { const errorMessage = [ `Template "${this.options.template}" is not supported.`, - ' Supported templates are: "aws-nodejs" and "aws-python".', + ` Supported templates are: ${humanReadableTemplateList}.`, ].join(''); throw new this.serverless.classes.Error(errorMessage); }