From 9ee4c12fff1002d9eda3a6777f537eb1d735ef54 Mon Sep 17 00:00:00 2001 From: Michel Jonathan Schmitz Date: Tue, 3 Sep 2019 16:12:14 +0200 Subject: [PATCH] fix: use arguments instead of options --- src/cli.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index 76ce2fe3..d2d90584 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -30,18 +30,20 @@ process.on('unhandledRejection', (error) => { /** * Uses arguments to paramtrize the connector execution + * + * backendURL - URL of the StApps backend deployment e.g. http://localhost:3000 + * origin - Origin, where the data comes from. Typically the name of the connector e.g. minimal-connector + * licensePlate - The license plate of your school. Must be matched to a SCNamespace e.g. f-u */ commander .version(connectorVersion) - .command('run') - .option('-b ', 'URL of the StApps backend deployment', 'http://localhost:3000') - .option('-o ', 'Origin, where the data comes from. Typically the name of the connector', 'minimal-connector') - .option('-l ', 'The license plate of your school. Must be matched to a SCNamespace', 'f-u') - .action(async (backend: string, origin: string, licensePlate: string) => { - if (backend.length === 0) { + .command('run ') + .action(async (backendURL: string, origin: string, licensePlate: string) => { + + if (backendURL.length === 0) { throw new Error('Param "backend" needs to have a length greater zero.'); } - const originRegex = /^[a-z\-\_0-9]*$/; + const originRegex = /^[a-z\-\_0-9]+$/; if (!originRegex.test(origin)) { throw new Error('Origin name can only consist of lowercase letters from a-z, "-", "_" and integer numbers.'); } @@ -53,7 +55,7 @@ commander // TODO for connector-developers: set your connector here const connector = new MinimalConnector(licensePlate, origin); - await executeConnector(backend, connector); + await executeConnector(backendURL, connector); Logger.ok('Done'); }, );