From ff3e5eb9744e3ce2caef280715e4a04934404e48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Verg=C3=A9?= Date: Thu, 28 Nov 2024 09:13:08 +0100 Subject: [PATCH] Fix internxt list --non-interactive Since version 1.3.1 and commit 64f9aec, the command `internxt list --non-interactive` doesn't work anymore, because it asks for an interactive input from the user: $ internxt list --non-interactive What is the folder id you want to list? (leave empty for the root folder): This commit fixes by assuming "root folder" when no UUID is passed (samed behavior as before 1.3.1). --- src/commands/list.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/commands/list.ts b/src/commands/list.ts index 1350427e..07ea5c8f 100644 --- a/src/commands/list.ts +++ b/src/commands/list.ts @@ -34,7 +34,7 @@ export default class List extends Command { let folderUuid = await this.getFolderUuid(flags['id'], nonInteractive); - if (folderUuid.trim().length === 0) { + if (!folderUuid || folderUuid.trim().length === 0) { // folderId is empty from flags&prompt, which means we should use RootFolderUuid folderUuid = userCredentials.root_folder_uuid; } @@ -114,7 +114,7 @@ export default class List extends Command { this.exit(1); } - public getFolderUuid = async (folderUuidFlag: string | undefined, nonInteractive: boolean): Promise => { + public getFolderUuid = async (folderUuidFlag: string | undefined, nonInteractive: boolean): Promise => { let folderUuid = CLIUtils.getValueFromFlag( { value: folderUuidFlag, @@ -125,7 +125,7 @@ export default class List extends Command { nonInteractive, (folderUuid: string) => ValidationService.instance.validateUUIDv4(folderUuid), ); - if (!folderUuid) { + if (!folderUuid && !nonInteractive) { folderUuid = (await this.getFolderUuidInteractively()).trim(); } return folderUuid;