Skip to content

Commit 5692c6a

Browse files
committed
Fixed autocomplete.
1 parent 35b2622 commit 5692c6a

File tree

2 files changed

+91
-13
lines changed

2 files changed

+91
-13
lines changed

package-lock.json

Lines changed: 75 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/interactive.mjs

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,27 @@ import {
1414
getGitBranches,
1515
deployBranch
1616
} from './lagoon-api.mjs';
17+
import autocomplete from 'inquirer-autocomplete-prompt';
1718
import { logAction } from './logger.mjs';
1819
import { configureSshKey } from './lagoon-ssh-key-configurator.mjs';
1920

2021
// Register the autocomplete prompt with inquirer
21-
try {
22-
const autocompletePrompt = (await import('inquirer-autocomplete-prompt')).default;
23-
inquirer.registerPrompt('autocomplete', autocompletePrompt);
24-
} catch (error) {
25-
console.log(chalk.yellow('Autocomplete prompt not available, falling back to standard list selection.'));
26-
}
22+
inquirer.registerPrompt('autocomplete', autocomplete);
2723

2824
/**
2925
* Starts the interactive Lagoon CLI session for managing projects and environments.
3026
*
31-
* Guides the user through selecting a Lagoon instance and project, then presents a menu of actions such as listing environments or users, deleting environments, generating login links, clearing Drupal cache, deploying branches, configuring SSH keys, and changing selections. Handles errors gracefully and logs key actions throughout the session.
27+
* Guides the user through selecting a Lagoon instance and project, then presents a menu of actions such as listing
28+
* environments or users, deleting environments, generating login links, clearing Drupal cache, deploying branches,
29+
* configuring SSH keys, and changing selections. Handles errors gracefully and logs key actions throughout the session.
3230
*/
3331
/**
34-
* Launches the interactive Lagoon CLI wrapper, allowing users to manage projects and environments through a guided command-line interface.
32+
* Launches the interactive Lagoon CLI wrapper, allowing users to manage projects and environments through a guided
33+
* command-line interface.
3534
*
36-
* Presents menus for selecting Lagoon instances and projects, and provides options to list environments or users, delete environments, generate login links, clear Drupal cache, configure SSH keys, and change selections. Handles errors gracefully and logs major actions throughout the session.
35+
* Presents menus for selecting Lagoon instances and projects, and provides options to list environments or users,
36+
* delete environments, generate login links, clear Drupal cache, configure SSH keys, and change selections. Handles
37+
* errors gracefully and logs major actions throughout the session.
3738
*/
3839
export async function startInteractiveMode() {
3940
console.log(chalk.green('Welcome to the Lagoon CLI Wrapper!'));
@@ -149,10 +150,10 @@ async function selectLagoonInstance() {
149150
}
150151

151152
/**
152-
* Prompts the user to select a project from the specified Lagoon instance and returns the selected project's name and details.
153+
* Prompts the user to select a project from the specified Lagoon instance and returns selected project's details.
153154
*
154155
* @param {string} instance - The Lagoon instance from which to load projects.
155-
* @returns {{ projectName: string, projectDetails: object }} An object containing the selected project's name and its details.
156+
* @returns {{ projectName: string, projectDetails: object }} An object containing project's name & details.
156157
*/
157158
async function selectProjectWithDetails(instance) {
158159
const spinner = ora(`Loading projects for ${instance}...`).start();
@@ -423,7 +424,8 @@ async function generateLoginLinkFlow(instance, project, githubBaseUrl) {
423424
/**
424425
* Guides the user through clearing the Drupal cache for a selected environment in a Lagoon project.
425426
*
426-
* Prompts the user to choose an environment, attempts to clear its Drupal cache, and displays the result or any errors encountered.
427+
* Prompts the user to choose an environment, attempts to clear its Drupal cache, and displays the result or any
428+
* errors encountered.
427429
*/
428430
async function clearCacheFlow(instance, project, githubBaseUrl) {
429431
const spinner = ora(`Loading environments for ${project}...`).start();
@@ -486,7 +488,8 @@ async function clearCacheFlow(instance, project, githubBaseUrl) {
486488
/**
487489
* Guides the user through deploying a selected Git branch for a Lagoon project via the interactive CLI.
488490
*
489-
* Prompts the user to select a branch from the project's Git repository, confirms deployment, and initiates the deployment process. Provides feedback on success or failure and informs the user that deployment is asynchronous.
491+
* Prompts the user to select a branch from the project's Git repository, confirms deployment, and initiates the
492+
* deployment process. Provides feedback on success or failure and informs the user that deployment is asynchronous.
490493
*
491494
* @param {string} instance - The Lagoon instance identifier.
492495
* @param {string} project - The Lagoon project name.

0 commit comments

Comments
 (0)