diff --git a/lib/commands/fullscans/create.js b/lib/commands/fullscans/create.js index 562efa73..f8e83ac9 100644 --- a/lib/commands/fullscans/create.js +++ b/lib/commands/fullscans/create.js @@ -1,7 +1,11 @@ /* eslint-disable no-console */ +import { stdin as inputText, stdout as output } from 'node:process' +import * as readline from 'node:readline/promises' + import chalk from 'chalk' import meow from 'meow' +import open from 'open' import ora from 'ora' import { ErrorWithCause } from 'pony-cause' @@ -21,7 +25,7 @@ export const create = { const input = await setupCommand(name, create.description, argv, importMeta) if (input) { - const spinnerText = 'Creating a full scan...' + const spinnerText = 'Creating a full scan... \n' const spinner = ora(spinnerText).start() await createFullScan(input, spinner) @@ -197,12 +201,19 @@ async function createFullScan (input, spinner) { if (!result.success) { return handleUnsuccessfulApiResponse('CreateOrgFullScan', result, spinner) } + spinner.stop() - console.log('\n Full scan created successfully \n') - const link = chalk.hex('#FF08E8').underline(`${result.data.html_report_url}`) - console.log(`Check it out at ${link} \n`) + console.log('\nāœ… Full scan created successfully \n') + const link = chalk.hex('#00FFFF').underline(`${result.data.html_report_url}`) + console.log(`Available at: ${link} \n`) - spinner.stop() + const rl = readline.createInterface({ input: inputText, output }) + + const answer = await rl.question('Would you like to open it in your browser? (y/n) ') + + answer.toLowerCase() === 'y' && open(`${result.data.html_report_url}`) + + rl.close() return { data: result.data diff --git a/lib/commands/fullscans/delete.js b/lib/commands/fullscans/delete.js index bc0cf9a0..38b5843c 100644 --- a/lib/commands/fullscans/delete.js +++ b/lib/commands/fullscans/delete.js @@ -101,7 +101,7 @@ async function deleteOrgFullScan (orgSlug, fullScanId, spinner) { return handleUnsuccessfulApiResponse('deleteOrgFullScan', result, spinner) } - console.log('\n Full scan deleted successfully. \n') + console.log('\n āœ… Full scan deleted successfully. \n') spinner.stop() diff --git a/package.json b/package.json index a96ae080..e33a39d5 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "//postinstall": "node ./cli.js wrapper --postinstall" }, "devDependencies": { - "@socketsecurity/eslint-config": "^3.0.1", + "@socketsecurity/eslint-config": "^3.0.0", "@tsconfig/node14": "^14.1.0", "@types/chai": "^4.3.3", "@types/chai-as-promised": "^7.1.5", @@ -92,9 +92,11 @@ "is-interactive": "^2.0.0", "is-unicode-supported": "^1.3.0", "meow": "^12.0.1", + "open": "^9.1.0", "ora": "^7.0.1", "pony-cause": "^2.1.8", "prompts": "^2.4.2", + "strip-ansi": "^7.1.0", "terminal-link": "^3.0.0", "update-notifier": "^6.0.2", "which": "^3.0.0"