1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-18 07:52:14 +01:00

CLI: library manager install latest if version is not specified

This commit is contained in:
Federico Fissore 2015-04-08 15:44:11 +02:00
parent ba3ecff13c
commit d022111fde

View File

@ -370,7 +370,16 @@ public class Base {
String[] libraryToInstallParts = parser.getLibraryToInstall().split(":"); 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) { if (selected == null) {
System.out.println(_("Selected library is not available")); System.out.println(_("Selected library is not available"));
System.exit(1); System.exit(1);