From cf342dd00eaae8667984e77eb565040c132f160a Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Mon, 5 Mar 2018 15:31:42 -0800 Subject: Change url command line option to endpoint-url --- packages/sra-report/README.md | 2 +- packages/sra-report/src/index.ts | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/sra-report/README.md b/packages/sra-report/README.md index 49609aeb2..53c007e10 100644 --- a/packages/sra-report/README.md +++ b/packages/sra-report/README.md @@ -13,7 +13,7 @@ sra-report Options: --help Show help [boolean] --version Show version number [boolean] - --url, -u API endpoint to test for standard relayer API compliance + --endpoint-url, -e API endpoint url to test for standard relayer API compliance [string] [required] --output, -o, --out Folder where to write the reports [string] --network-id, -n ID of the network that the API is serving orders from diff --git a/packages/sra-report/src/index.ts b/packages/sra-report/src/index.ts index 327c495ae..c74b5cb40 100644 --- a/packages/sra-report/src/index.ts +++ b/packages/sra-report/src/index.ts @@ -19,9 +19,9 @@ const SUPPORTED_NETWORK_IDS = [1, 42]; // extract command line arguments const args = yargs - .option('url', { - alias: ['u'], - describe: 'API endpoint to test for standard relayer API compliance', + .option('endpoint-url', { + alias: ['e'], + describe: 'API endpoint url to test for standard relayer API compliance', type: 'string', demandOption: true, }) @@ -38,13 +38,13 @@ const args = yargs type: 'number', default: DEFAULT_NETWORK_ID, }) - .example("$0 --url 'http://api.example.com' --out 'src/contracts/generated/' --network-id 42", 'Full usage example') + .example("$0 --endpoint-url 'http://api.example.com' --out 'src/contracts/generated/' --network-id 42", 'Full usage example') .argv; // perform extra validation on command line arguments try { - assert.isWebUri('args', args.url); + assert.isWebUri('args', args.endpointUrl); } catch (err) { - utils.log(`${chalk.red(`Invalid url format:`)} ${args.url}`); + utils.log(`${chalk.red(`Invalid url format:`)} ${args.endpointUrl}`); process.exit(1); } if (!_.includes(SUPPORTED_NETWORK_IDS, args.networkId)) { @@ -54,7 +54,7 @@ if (!_.includes(SUPPORTED_NETWORK_IDS, args.networkId)) { } const mainAsync = async () => { - const httpClient = new HttpClient(args.url); + const httpClient = new HttpClient(args.endpointUrl); const orders = await httpClient.getOrdersAsync(); const firstOrder = _.head(orders); if (_.isUndefined(firstOrder)) { @@ -62,7 +62,7 @@ const mainAsync = async () => { } const newmanEnvironmentOptions = { collection: sraReportCollectionJSON, - globals: postmanEnvironmentFactory.createGlobalEnvironment(args.url, firstOrder), + globals: postmanEnvironmentFactory.createGlobalEnvironment(args.endpointUrl, firstOrder), environment: postmanEnvironmentFactory.createNetworkEnvironment(args.networkId), }; const newmanReporterOptions = !_.isUndefined(args.output) -- cgit v1.2.3