mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-17 06:52:18 +01:00
CLI: library manager install latest if version is not specified
This commit is contained in:
parent
ba3ecff13c
commit
d022111fde
@ -370,7 +370,16 @@ public class Base {
|
||||
|
||||
String[] libraryToInstallParts = parser.getLibraryToInstall().split(":");
|
||||
|
||||
ContributedLibrary selected = indexer.getIndex().find(libraryToInstallParts[0], VersionHelper.valueOf(libraryToInstallParts[1]).toString());
|
||||
ContributedLibrary selected=null;
|
||||
if (libraryToInstallParts.length == 2) {
|
||||
selected = indexer.getIndex().find(libraryToInstallParts[0], VersionHelper.valueOf(libraryToInstallParts[1]).toString());
|
||||
} else if (libraryToInstallParts.length == 1) {
|
||||
List<ContributedLibrary> librariesByName = indexer.getIndex().find(libraryToInstallParts[0]);
|
||||
Collections.sort(librariesByName, new DownloadableContributionVersionComparator());
|
||||
if (!librariesByName.isEmpty()) {
|
||||
selected = librariesByName.get(librariesByName.size() - 1);
|
||||
}
|
||||
}
|
||||
if (selected == null) {
|
||||
System.out.println(_("Selected library is not available"));
|
||||
System.exit(1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user