-
-
Notifications
You must be signed in to change notification settings - Fork 72
Location of CLI config file #327
Description
Is your feature request related to a problem? Please describe.
This doesn't describe a problem, it suggests an improvement.
This discussion is based on the Windows environment, but it is probably equally applicable to Linux and Mac.
The CLI config documentation, found here, describes where CLI looks for a config file:
1. Location specified by the --config-file command line flag
2. Current working directory
3. Any parent directory of the current working directory (more immediate parents having higher precedence)
4. Arduino CLI data directory (as configured by directories.data)
However, when one opens the CLI config in the IDE (File->Open CLI configuration) it creates/opens C:\Users\myname\.arduinoProIDE\arduino-cli.yaml
- and it works fine in the IDE.
The discomfort is caused by the fact that if the user would like to use the CLI from the command line, it (the CLI) doesn't find the above config file without extra setup work.
Describe the solution you'd like
It would seem more user-friendly (especially to beginners, myself included) if C:\Users\myname\.arduinoProIDE
were in the list of places the CLI looks for its config (probably best as the last element in the list). That way it would be straightforward to have a single config file for both the IDE and the CLI itself.
Describe alternatives you've considered
It sounds philosophically bad for the CLI to look for the file in an IDE-related folder, so a slightly more complex (and versatile) solution would be this:
- there is a default location for the CLI's config (e.g.
C:\Users\myname\.arduino-cli
- that's nice because it's similar to the IDE folder) - the IDE looks for the CLI config in
C:\Users\myname\.arduinoProIDE
first and, if not found, uses the one in the default CLI location - if the IDE is using the default CLI config and changes are made to it (from within the IDE), the IDE asks "Do you want to change the default file or create a specific one for the IDE?"
- if an IDE-specific one is requested, that is put in
C:\Users\myname\.arduinoProIDE
and, from then on, the IDE will find it first and use it - obviously if the option is to change the default one, the IDE continues to use the default
- there would need to be a way to return to using the default (the simple way to do that being to delete the file in
C:\Users\myname\.arduinoProIDE
)
Additional context
This all started because I changed the directories.data and directories.downloads entries in the config file. I edited it in the IDE, then tried to install boards and compile my sketch using the CLI. The downloads and installations all went to their default locations, as if I hadn't changed the configuration!
I was in a situation where I could type the config file and it had my desired settings, but when I did arduino-cli config dump
, I got the default values. It was only when I used the --verbose flag
that I discovered that it was using the default values because it couldn't find any config file!
This sounds like a situation others might run into.