mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-26 13:19:42 +00:00
Filter extensions by category (#77306)
* Revert commit change * Revert commit change * Revert commit change * Revert commit change * Revert commit change * Revert commit change * Provide option to filter by category * ignore casing * Remove unwanted build change
This commit is contained in:
@@ -86,7 +86,7 @@ export class Main {
|
||||
await this.setInstallSource(argv['install-source']);
|
||||
|
||||
} else if (argv['list-extensions']) {
|
||||
await this.listExtensions(!!argv['show-versions']);
|
||||
await this.listExtensions(!!argv['show-versions'], argv['category']);
|
||||
|
||||
} else if (argv['install-extension']) {
|
||||
const arg = argv['install-extension'];
|
||||
@@ -110,8 +110,17 @@ export class Main {
|
||||
return writeFile(this.environmentService.installSourcePath, installSource.slice(0, 30));
|
||||
}
|
||||
|
||||
private async listExtensions(showVersions: boolean): Promise<void> {
|
||||
const extensions = await this.extensionManagementService.getInstalled(ExtensionType.User);
|
||||
private async listExtensions(showVersions: boolean, category?: string): Promise<void> {
|
||||
let extensions = await this.extensionManagementService.getInstalled(ExtensionType.User);
|
||||
if (category) {
|
||||
extensions = extensions.filter(e => {
|
||||
if (e.manifest.categories) {
|
||||
const lowerCaseCategories: string[] = e.manifest.categories.map(c => c.toLowerCase());
|
||||
return lowerCaseCategories.indexOf(category.toLowerCase()) > -1;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
extensions.forEach(e => console.log(getId(e.manifest, showVersions)));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user