Skip to content

Commit d022111

Browse files
author
Federico Fissore
committed
CLI: library manager install latest if version is not specified
1 parent ba3ecff commit d022111

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

app/src/processing/app/Base.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,16 @@ protected void onProgress(Progress progress) {
370370

371371
String[] libraryToInstallParts = parser.getLibraryToInstall().split(":");
372372

373-
ContributedLibrary selected = indexer.getIndex().find(libraryToInstallParts[0], VersionHelper.valueOf(libraryToInstallParts[1]).toString());
373+
ContributedLibrary selected=null;
374+
if (libraryToInstallParts.length == 2) {
375+
selected = indexer.getIndex().find(libraryToInstallParts[0], VersionHelper.valueOf(libraryToInstallParts[1]).toString());
376+
} else if (libraryToInstallParts.length == 1) {
377+
List<ContributedLibrary> librariesByName = indexer.getIndex().find(libraryToInstallParts[0]);
378+
Collections.sort(librariesByName, new DownloadableContributionVersionComparator());
379+
if (!librariesByName.isEmpty()) {
380+
selected = librariesByName.get(librariesByName.size() - 1);
381+
}
382+
}
374383
if (selected == null) {
375384
System.out.println(_("Selected library is not available"));
376385
System.exit(1);

0 commit comments

Comments
 (0)