Description
Enhancement
An instance keeps track of all the information needed by the CLI to correctly run all its commands and gRPC functions. The commands
package keeps track of all the instances created, the CLI needs only one instance to work correctly apart when running as daemon
mode. When running in daemon
mode the clients connected to it can create any number of instances.
As of now all commands of the cli
package handle the creation and the initialization of an instance whenever it's necessary. This behaviour is fine since all commands, apart from daemon
, are "one shot", they're executed and exit when done.
Until now there have been no cases in which we would have benefited from reusing an already created and initialized instance when running the CLI in non-daemon mode, but in future we might need it to efficiently support interactivity and similar things.
For example to implement #1452 in an efficient manner we'll need to make this refactoring happen, otherwise the feature will be completely useless and even annoying for users with lots of platforms and/or libraries. Since as of now we create and initialize a new instance every time the user asks for --fqbn
completion in compile
.