From 2a3097453d75847710557e0617bab2ea42286206 Mon Sep 17 00:00:00 2001 From: Peter Hedenskog Date: Tue, 9 May 2023 13:05:27 +0200 Subject: [PATCH] api: fix text and change guard for not supplying URLs (#3834) If you as an API user just want to get the result, you don't need a URL. --- lib/cli/cli.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/cli/cli.js b/lib/cli/cli.js index 50e6dd802..4fec3c11a 100644 --- a/lib/cli/cli.js +++ b/lib/cli/cli.js @@ -149,6 +149,11 @@ function validateInput(argv) { return 'There is no benefit running debug mode inside a Docker container.'; } + // If we ask the API for finished test, we don't need a URL + if (argv._.length === 0 && !argv.api.id) { + return 'You need to supply one/multiple URLs or scripts'; + } + // validate URLs/files const urlOrFiles = argv._; for (let urlOrFile of urlOrFiles) { @@ -208,7 +213,6 @@ export async function parseCommandLine() { .parserConfiguration({ 'deep-merge-config': true }) .env('SITESPEED_IO') .usage('$0 [options] /') - .require(1, 'One or multiple URLs or scripts') .option('debugMessages', { default: false, @@ -1814,8 +1818,9 @@ export async function parseCommandLine() { }); parsed - .option('api.type', { - describe: 'The type of API call you want to do: S', + .option('api.action', { + describe: + 'The type of API call you want to do: You get add a test and wait for the result, just add a test or get the result. To get the result, make sure you add the id using --api.id', default: 'addAndGetResult', choices: ['add', 'addAndGetResult', 'get'], group: 'API' @@ -1838,7 +1843,8 @@ export async function parseCommandLine() { }) .option('api.id', { describe: - 'The id of the test. You it when you want to get the test result.', + 'The id of the test. Use it when you want to get the test result.', + type: 'string', group: 'API' }) .option('api.json', {