UNPKG

alwaysai

Version:

The alwaysAI command-line interface (CLI)

26 lines (22 loc) 504 B
import * as inquirer from 'inquirer'; import * as open from 'open'; export async function websitePrompt(url: string) { const choices = ['Yes', 'No']; const questions = [ { type: 'list', name: 'visitUrl', message: `Would you like to visit ${url} now?`, choices } ]; const answer = await inquirer.prompt(questions).then((answer) => { if (answer.visitUrl === 'Yes') { return true; } return false; }); if (answer) { await open(url); } }