Skip to content

Commit 72ddfa1

Browse files
committed
feat(compose): add profile and service scoping to logs command
Enhances the Compose logs command template and handler to support profile and service filtering: - Update composeLogs command template in package.json to include ${profileList} and ${serviceList} variables. - Pass profile (--profile) and service arguments to selectComposeLogsCommand in composeGroupLogs handler. - Update selectComposeLogsCommand parameter list and command template variables to interpolate profiles and services. Signed-off-by: h3110Fr13nd <vijaysinghkushwaha3737@gmail.com>
1 parent 1669a2a commit 72ddfa1

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

‎extensions/vscode-containers/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1846,7 +1846,7 @@
18461846
"default": [
18471847
{
18481848
"label": "Compose Logs",
1849-
"template": "${composeCommand} ${configurationFile} ${projectName} ${environmentFile} logs --tail 1000 -f"
1849+
"template": "${composeCommand} ${profileList} ${configurationFile} ${projectName} ${environmentFile} logs --tail 1000 -f ${serviceList}"
18501850
}
18511851
],
18521852
"description": "%vscode-containers.config.template.composeLogs.description%",

‎extensions/vscode-containers/src/commands/containers/composeGroup.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ export async function composeGroupLogs(context: IActionContext, node: ComposeGro
2929
const folder = workspace.getWorkspaceFolder(Uri.file(workingDirectory)) ?? Uri.file(workingDirectory);
3030

3131
const composeFilesString = options.files?.map(file => `-f "${file}"`).join(' ');
32-
return selectComposeLogsCommand(context, folder, composeFilesString, options.projectName, options.environmentFile);
32+
const profileListString = options.profiles?.map(profile => `--profile "${profile}"`).join(' ');
33+
const serviceListString = options.services?.join(' ');
34+
return selectComposeLogsCommand(context, folder, composeFilesString, options.projectName, options.environmentFile, profileListString, serviceListString);
3335
}, node, 'logs', { follow: true, tail: 1000 });
3436
}
3537

‎extensions/vscode-containers/src/commands/selectCommandTemplate.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export async function selectLogsCommand(context: IActionContext, containerName:
7979
);
8080
}
8181

82-
export async function selectComposeLogsCommand(context: IActionContext, folder: vscode.WorkspaceFolder | vscode.Uri, configurationFile?: string, projectName?: string, envFile?: string): Promise<VoidCommandResponse> {
82+
export async function selectComposeLogsCommand(context: IActionContext, folder: vscode.WorkspaceFolder | vscode.Uri, configurationFile?: string, projectName?: string, envFile?: string, profileList?: string, serviceList?: string): Promise<VoidCommandResponse> {
8383
const orchestratorClient = await ext.orchestratorManager.getClient();
8484
let fullComposeCommand: string;
8585
if (isComposeV2ableOrchestratorClient(orchestratorClient) && orchestratorClient.composeV2) {
@@ -99,7 +99,9 @@ export async function selectComposeLogsCommand(context: IActionContext, folder:
9999
'configurationFile': configurationFile || '',
100100
'projectName': projectName ? `-p "${projectName}"` : '',
101101
'environmentFile': envFile ? `--env-file "${envFile}"` : '',
102-
'composeCommand': fullComposeCommand
102+
'composeCommand': fullComposeCommand,
103+
'profileList': profileList || '',
104+
'serviceList': serviceList || ''
103105
}
104106
);
105107
}

0 commit comments

Comments
 (0)