Skip to content

Commit 584053f

Browse files
authored
[#9] Added autocomplete search to project and action selection
2 parents 5f53889 + 698b137 commit 584053f

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ This will start the interactive mode, which will guide you through:
5353

5454
## Features
5555

56-
- Interactive CLI interface
56+
- Interactive CLI interface with autocomplete search
5757
- Easy navigation between instances and projects
58+
- Type-to-search project selection with autocomplete
59+
- Fast action selection with search capability
5860
- Safe environment deletion (prevents deletion of protected environments)
5961
- GitHub PR integration for PR environments
6062
- One-click login link generation for Drupal environments

src/interactive.mjs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ import { logAction } from './logger.mjs';
1717
import { configureSshKey } from './lagoon-ssh-key-configurator.mjs';
1818

1919
// Import the modern inquirer prompts
20-
import { select } from '@inquirer/prompts';
21-
import { input } from '@inquirer/prompts';
22-
import { confirm } from '@inquirer/prompts';
23-
import { checkbox } from '@inquirer/prompts';
20+
import { select, input, confirm, checkbox, search } from '@inquirer/prompts';
2421

2522
/**
2623
* Starts the interactive Lagoon CLI session for managing projects and environments.
@@ -156,8 +153,9 @@ async function selectProjectWithDetails(instance) {
156153
const projectsWithDetails = await getProjectsWithDetails(instance);
157154
spinner.stop();
158155

159-
const project = await select({
160-
message: 'Select a project:',
156+
// Use search prompt with autocomplete functionality
157+
const project = await search({
158+
message: 'Select a project (type to search):',
161159
choices: projectsWithDetails.map(project => ({
162160
value: project.projectname,
163161
label: project.projectname
@@ -183,8 +181,8 @@ async function showMainMenu(instance, project) {
183181
console.log(chalk.blue(`\nCurrent Instance: ${chalk.bold(instance)}`));
184182
console.log(chalk.blue(`Current Project: ${chalk.bold(project)}\n`));
185183

186-
const action = await select({
187-
message: 'What would you like to do?',
184+
const action = await search({
185+
message: 'What would you like to do? (type to search)',
188186
choices: [
189187
{ value: 'listEnvironments', label: 'List Environments' },
190188
{ value: 'listUsers', label: 'List Users' },

0 commit comments

Comments
 (0)