Documentation ¶
Index ¶
- func AskForUserFields(userFields []*rpc.UserField) (map[string]string, error)
- func CalculateFQBNAndPort(portArgs *Port, fqbnArg *Fqbn, instance *rpc.Instance, ...) (string, *rpc.Port)
- func CheckFlagsConflicts(command *cobra.Command, flagNames ...string)
- func CheckFlagsMandatory(command *cobra.Command, flagNames ...string)
- func GetConnectedBoards() []string
- func GetInstallableCores() []string
- func GetInstallableLibs() []string
- func GetInstalledBoards() []string
- func GetInstalledLibraries() []string
- func GetInstalledProgrammers() []string
- func GetInstalledProtocols() []string
- func GetUninstallableCores() []string
- func GetUninstallableLibraries() []string
- func InitSketchPath(path string) (sketchPath *paths.Path)
- func WarnDeprecatedFiles(sketchPath *paths.Path)
- type DiscoveryTimeout
- type Fqbn
- type Port
- func (p *Port) AddToCommand(cmd *cobra.Command)
- func (p *Port) DetectFQBN(inst *rpc.Instance) (string, *rpc.Port)
- func (p *Port) GetPort(instance *rpc.Instance, defaultAddress, defaultProtocol string) (*rpc.Port, error)
- func (p *Port) GetPortAddressAndProtocol(instance *rpc.Instance, defaultAddress, defaultProtocol string) (string, string, error)
- func (p *Port) GetSearchTimeout() time.Duration
- type PostInstallFlags
- type Profile
- type Programmer
- type Reference
- type ShowProperties
- type ShowPropertiesMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AskForUserFields ¶
AskForUserFields prompts the user to input the provided user fields. If there is an error reading input it panics.
func CalculateFQBNAndPort ¶
func CalculateFQBNAndPort(portArgs *Port, fqbnArg *Fqbn, instance *rpc.Instance, defaultFQBN, defaultAddress, defaultProtocol string) (string, *rpc.Port)
CalculateFQBNAndPort calculate the FQBN and Port metadata based on parameters provided by the user. This determine the FQBN based on: - the value of the FQBN flag if explicitly specified, otherwise - the default FQBN value in sketch.yaml (`default_fqbn` key) if available, otherwise - it tries to autodetect the board connected to the given port flags If all above methods fails, it returns the empty string. The Port metadata are always returned except if:
- the port is not found, in this case nil is returned
- the FQBN autodetection fail, in this case the function prints an error and terminates the execution
func CheckFlagsConflicts ¶
CheckFlagsConflicts is a helper function useful to report errors when more than one conflicting flag is used
func CheckFlagsMandatory ¶
CheckFlagsMandatory is a helper function useful to report errors when at least one flag is not used in a group of "required" flags
func GetConnectedBoards ¶
func GetConnectedBoards() []string
GetConnectedBoards is an helper function useful to autocomplete. It returns a list of boards which are currently connected Obviously it does not suggests network ports because of the timeout
func GetInstallableCores ¶
func GetInstallableCores() []string
GetInstallableCores is an helper function useful to autocomplete. It returns a list of cores which can be installed/downloaded
func GetInstallableLibs ¶
func GetInstallableLibs() []string
GetInstallableLibs is an helper function useful to autocomplete. It returns a list of libs which can be installed/downloaded
func GetInstalledBoards ¶
func GetInstalledBoards() []string
GetInstalledBoards is an helper function useful to autocomplete. It returns a list of fqbn it's taken from cli/board/listall.go
func GetInstalledLibraries ¶
func GetInstalledLibraries() []string
GetInstalledLibraries is an helper function useful to autocomplete. It returns a list of libs which are currently installed, including the builtin ones
func GetInstalledProgrammers ¶
func GetInstalledProgrammers() []string
GetInstalledProgrammers is an helper function useful to autocomplete. It returns a list of programmers available based on the installed boards
func GetInstalledProtocols ¶
func GetInstalledProtocols() []string
GetInstalledProtocols is an helper function useful to autocomplete. It returns a list of protocols available based on the installed boards
func GetUninstallableCores ¶
func GetUninstallableCores() []string
GetUninstallableCores is an helper function useful to autocomplete. It returns a list of cores which can be uninstalled
func GetUninstallableLibraries ¶
func GetUninstallableLibraries() []string
GetUninstallableLibraries is an helper function useful to autocomplete. It returns a list of libs which can be uninstalled
func InitSketchPath ¶
func InitSketchPath(path string) (sketchPath *paths.Path)
InitSketchPath returns an instance of paths.Path pointing to sketchPath. If sketchPath is an empty string returns the current working directory. In both cases it warns the user if he's using deprecated files
func WarnDeprecatedFiles ¶
func WarnDeprecatedFiles(sketchPath *paths.Path)
WarnDeprecatedFiles warns the user that a type of sketch files are deprecated
Types ¶
type DiscoveryTimeout ¶
type DiscoveryTimeout struct {
// contains filtered or unexported fields
}
DiscoveryTimeout is the timeout given to discoveries to detect ports.
func (*DiscoveryTimeout) AddToCommand ¶
func (d *DiscoveryTimeout) AddToCommand(cmd *cobra.Command)
AddToCommand adds the flags used to set fqbn to the specified Command
func (*DiscoveryTimeout) Get ¶
func (d *DiscoveryTimeout) Get() time.Duration
Get returns the timeout
type Fqbn ¶
type Fqbn struct {
// contains filtered or unexported fields
}
Fqbn contains the fqbn flag data. This is useful so all flags used by commands that need this information are consistent with each other.
func (*Fqbn) AddToCommand ¶
AddToCommand adds the flags used to set fqbn to the specified Command
type Port ¶
type Port struct {
// contains filtered or unexported fields
}
Port contains the port arguments result. This is useful so all flags used by commands that need this information are consistent with each other.
func (*Port) AddToCommand ¶
AddToCommand adds the flags used to set port and protocol to the specified Command
func (*Port) DetectFQBN ¶
DetectFQBN tries to identify the board connected to the port and returns the discovered Port object together with the FQBN. If the port does not match exactly 1 board,
func (*Port) GetPort ¶
func (p *Port) GetPort(instance *rpc.Instance, defaultAddress, defaultProtocol string) (*rpc.Port, error)
GetPort returns the Port obtained by parsing command line arguments. The extra metadata for the ports is obtained using the pluggable discoveries.
func (*Port) GetPortAddressAndProtocol ¶
func (p *Port) GetPortAddressAndProtocol(instance *rpc.Instance, defaultAddress, defaultProtocol string) (string, string, error)
GetPortAddressAndProtocol returns only the port address and the port protocol without any other port metadata obtained from the discoveries. This method allows will bypass the discoveries if: - a nil instance is passed: in this case the plain port and protocol arguments are returned (even if empty) - a protocol is specified: in this case the discoveries are not needed to autodetect the protocol.
func (*Port) GetSearchTimeout ¶
GetSearchTimeout returns the timeout
type PostInstallFlags ¶
type PostInstallFlags struct {
// contains filtered or unexported fields
}
PostInstallFlags contains flags data used by the core install and the upgrade command This is useful so all flags used by commands that need this information are consistent with each other.
func (*PostInstallFlags) AddToCommand ¶
func (p *PostInstallFlags) AddToCommand(cmd *cobra.Command)
AddToCommand adds flags that can be used to force running or skipping of post installation scripts
func (*PostInstallFlags) DetectSkipPostInstallValue ¶
func (p *PostInstallFlags) DetectSkipPostInstallValue() bool
DetectSkipPostInstallValue returns true if a post install script must be run
func (*PostInstallFlags) GetRunPostInstall ¶
func (p *PostInstallFlags) GetRunPostInstall() bool
GetRunPostInstall returns the run-post-install flag value
func (*PostInstallFlags) GetSkipPostInstall ¶
func (p *PostInstallFlags) GetSkipPostInstall() bool
GetSkipPostInstall returns the skip-post-install flag value
type Profile ¶
type Profile struct {
// contains filtered or unexported fields
}
Profile contains the profile flag data. This is useful so all flags used by commands that need this information are consistent with each other.
func (*Profile) AddToCommand ¶
AddToCommand adds the flags used to set fqbn to the specified Command
type Programmer ¶
type Programmer struct {
// contains filtered or unexported fields
}
Programmer contains the programmer flag data. This is useful so all flags used by commands that need this information are consistent with each other.
func (*Programmer) AddToCommand ¶
func (p *Programmer) AddToCommand(cmd *cobra.Command)
AddToCommand adds the flags used to set the programmer to the specified Command
type Reference ¶
Reference represents a reference item (core or library) passed to the CLI interface
func ParseReference ¶
ParseReference parses a string and returns a Reference object. It tries to infer the platform the user is asking for. To achieve that, it tries to use github.com/jacoblai/arduino-cli/commands/core.GetPlatform Note that the Reference is returned rightaway if the arg inserted by the user matches perfectly one in the response of core.GetPlatform A MultiplePlatformsError is returned if the platform searched by the user matches multiple platforms
func ParseReferences ¶
ParseReferences is a convenient wrapper that operates on a slice of strings and calls ParseReference for each of them. It returns at the first invalid argument.
type ShowProperties ¶
type ShowProperties struct {
// contains filtered or unexported fields
}
ShowProperties represents the --show-properties flag.
func (*ShowProperties) AddToCommand ¶
func (p *ShowProperties) AddToCommand(command *cobra.Command)
AddToCommand adds the --show-properties flag to the specified command.
func (*ShowProperties) Get ¶
func (p *ShowProperties) Get() (ShowPropertiesMode, error)
Get returns the corresponding ShowProperties value.
type ShowPropertiesMode ¶
type ShowPropertiesMode int
ShowPropertiesMode represents the possible values of the --show-properties flag.
const ( // ShowPropertiesDisabled means that the --show-properties flag has not been used ShowPropertiesDisabled ShowPropertiesMode = iota // ShowPropertiesUnexpanded means that the --show-properties flag has been used without a value or with the value "unexpanded" ShowPropertiesUnexpanded // ShowPropertiesExpanded means that the --show-properties flag has been used with the value "expanded" ShowPropertiesExpanded )