* CLI: Add --version to CLI option
I added to get the Arduino IDE version from the command line
It will allow to check easily if the new Arduino is already installed.
This feature makes it easier to build external systems linked to specific versions of Arduino.
1. I added `--version` action, which shows version name and exit
1. Currently, VERSION_NAME_LONG (like `1.8.5`, `1.9.0-beta`, `1.8.6 Hourly Build XXX`, etc...) is used. Because I want to know its version number and stable/beta/hourly.
2. Finish with `0`. Because it is `SUCCESSFLLY FINISHED`.
2. Updated man page.
* Split "parse" and "action".
Move print action to probably suitable place.
This commit will fix the behavior of multiple actions about --version.
* add testcase
The core libraries may come from platforms installed inside the
"sketchbook/hardware" directory. Those platforms are not indexed
and doesn't have a category field to propagate in the core-libraries.
Those fields have a slightly different meaning on each object that
extends DownloadableContribution and having them grouped in
DownloadableContribution only increase confusion in change of a
(very) tiny code reuse.
Moreover:
- the `readOnly` field has been renamed to `builtIn`
- predicates have been replaced by lambdas
- DownloadableContributionBuiltInAtTheBottomComparator has been replaced
with a singleton instance
- replaced the logic to check if an installed-library is a
builtin library by reusing the same method available in
ContributedLibraryReleases
- renamed some local vars to better reflect their contents:
uninstalledLibraries -> notInstalled
uninstalledNewerReleases -> notInstalledNewer
uninstalledPreviousReleases -> notInstalledPrevious
This class allows to attach a Location property to a folder
path, this way we directly know if a library is in the sketchbook,
core, referenced-core or bundled in the IDE.
This simplify a lot of logic in the IDE.
ContributedLibrary is used to decode library_index.json and it's
intended to keep data coming only from the index.
Now, when the library_index is synced with the filesystem, the
metadata about installed libraries are kept in a separate list
to not mess up with the main index.
Previously the filtering was made on ContributedLibrary, but the
objects that is actually displayed is a ContributeLibraryReleases,
so it comens natural to filter on this class of objects.
Apparently the functionality is not affected by this commit, but
there may be some side-effect that may probably fix some
visualization bug.
Optional<T> helps to not forget to check about nullness where it is
needed.
This commit should be equivalent and shouln't fix any bug, BTW the
Optional<T> semantic turns out to be useful in the next commits.
Possibly all nullable values will be replaced by Optional in the
future.
- we ensure that there is always a filter selected, no more need
to check for non-nullness
- the filters are always the same, no need to pass a
Stream<Predicate<T>> around where Predicate<T> suffices
Since the method is called everywhere with the following parameters
isReadOnly(
BaseNoGui.librariesIndexer.getInstalledLibraries(),
BaseNoGui.getExamplesPath())
)
the static calls to BaseNoGui have been inlined into isReadOnly()
removing all the duplications around.