• Cristian Maglie's avatar
    [skip-changelog] refactor: Made `command` functions to access PackageManager... · 4b2a32be
    Cristian Maglie authored
    [skip-changelog] refactor: Made `command` functions to access PackageManager unavailable from public API (#2335)
    
    * Let instance commands require an *rpc.Instance
    
    Removed the shorthand of the InstanceCommand interface.
    This makes the API more coherent among the `commands` instance handling.
    
    * Moved 'command' package's instances functions inside internal package
    
    This change highlights the incorrect PackageManager access in 'cli'
    package. Now those are errors:
    
    package github.com/arduino/arduino-cli
    	imports github.com/arduino/arduino-cli/internal/cli
    	imports github.com/arduino/arduino-cli/internal/cli/board
    	imports github.com/arduino/arduino-cli/internal/cli/arguments
    	internal/cli/arguments/completion.go:23:2: use of internal package github.com/arduino/arduino-cli/commands/internal/instances not allowed
    package github.com/arduino/arduino-cli
    	imports github.com/arduino/arduino-cli/internal/cli
    	imports github.com/arduino/arduino-cli/internal/cli/board
    	imports github.com/arduino/arduino-cli/internal/cli/arguments
    	internal/cli/arguments/port.go:24:2: use of internal package github.com/arduino/arduino-cli/commands/internal/instances not allowed
    
    * Made CoreInstance private
    
    * Inlined coreInstancesContainer singleton methods
    
    * Removed all wrong accesses to package Explorer
    
    * Replaced DiscoveryManager.Watch with equivalent gRPC BoardListWatch call
    
    * Replaced direct access to PackageManager to get discovery protocols
    
    Previously the function GetConnectedBoards() counter-intuitively
    returned a list of port address. Now it has been reneamed
    GetAvailablePorts() and returns the full Port object that is mapped into
    an array of Addresses or into an array of Prorocols based on the
    auto-completion request.
    4b2a32be
listall.go 4.19 KB