Bash expands bare $@, and then do word-splitting and file-globing. It breaks command-line arguments
for arduino if command-line arguments for the wrapper script contains $IFS, '*', '?' and etc. characters.
Use "$@" in this case.
Amendment to CLI documentation re: Windows GUI/console executable differences and behaviours, as per #3461, unless it is expected to change in the near future...
In a lot of places, (potentially) relative paths were passed to File
without any processing, making them be resolved without taking into
account --curdir. By passing them through Base.absoluteFile instead,
these paths are resolved relative to the working directory before
starting arduino (at least on Linux, which is currently the only
platform supporting --curdir).
This applies --curdir to the --preferences-file option and the
build.path, settings.path, sketchbook.path preferences.
For example, this now works as expected:
arduino --pref build.path=build_dir --verify Blink.ino
This option causes the IDE to process its commandline arguments and then
quit. This allows setting preferences uses --pref, without having to
also load the GUI or compile a sketch.
This allows setting preferences for the current run only, without
remembering them for the next run. This is especially useful when
combined with --verify or --upload.
Since the handling of these options defaults to non-verbose (instead of
the current preference), they make no sense when starting the IDE
normally. Previously, these options would just be ignored in this case,
now an error is shown.
Previously, the --board and --port arguments were stored in a variable
first and only processed later. Now, the arguments are processed right
away.
This does mean that the arguments are processed when the GUI is not yet
initialized, which caused problems with calling onBoardOrPortChange and
friends from selectBoard. However, since the GUI is not initialized,
there is no real reason to call them either - if we just set the
preferences to the right values, the GUI will be initialized correctly
later. For this reason, selectBoard no longer calls the GUI update
methods. Instead, those are called from the GUI code when the board is
changed through the menu instead (e.g., after calling selectBoard).
This commit slightly changes behaviour. Previously, --board and --port
only worked in combination with --verify and --upload, but were ignored
when just starting the IDE. Now, these are processed regardless of the
other options present.
Additionally, this commit causes all changed preferences to be saved.
Previously, only changes with --pref were saved, --board and --port
options were only active for the current run. This was caused because
the saving of the preferences happened as a side effect of loading the
file in the Editor, but only the --pref option was processed at that
time.
Note that the --verbose options are still only active for the current
run and are only valid combined with --verify or --upload (since they
default to non-verbose instead of the current preference).
This adds a description of commandline options, files used and some
preferences in proper Unix manpage format. It is written in asciidoc,
which can easily be converted to both a native troff manpage, or HTML
(the latter can be done by github on-demand).