fix: cli no user input
This commit is contained in:
@@ -65,19 +65,28 @@ async function rateLimitedRequest(url, options = {}) {
|
||||
|
||||
console.log();
|
||||
|
||||
// Ask user what to do
|
||||
const { action } = await inquirer.prompt([
|
||||
{
|
||||
type: 'list',
|
||||
name: 'action',
|
||||
message: 'What would you like to do?',
|
||||
choices: [
|
||||
{ name: `Wait ${waitMinutes} minutes and continue`, value: 'wait' },
|
||||
{ name: 'Skip remaining items and continue with what we have', value: 'skip' },
|
||||
{ name: 'Abort indexing', value: 'abort' }
|
||||
]
|
||||
}
|
||||
]);
|
||||
// In CI mode, automatically wait instead of prompting
|
||||
const isCI = process.env.CI === 'true';
|
||||
let action = 'wait';
|
||||
|
||||
if (!isCI) {
|
||||
// Ask user what to do
|
||||
const response = await inquirer.prompt([
|
||||
{
|
||||
type: 'list',
|
||||
name: 'action',
|
||||
message: 'What would you like to do?',
|
||||
choices: [
|
||||
{ name: `Wait ${waitMinutes} minutes and continue`, value: 'wait' },
|
||||
{ name: 'Skip remaining items and continue with what we have', value: 'skip' },
|
||||
{ name: 'Abort indexing', value: 'abort' }
|
||||
]
|
||||
}
|
||||
]);
|
||||
action = response.action;
|
||||
} else {
|
||||
console.log(chalk.cyan('🤖 CI mode detected: automatically waiting...'));
|
||||
}
|
||||
|
||||
if (action === 'abort') {
|
||||
throw new Error('Indexing aborted by user');
|
||||
|
||||
Reference in New Issue
Block a user