Movatterモバイル変換


[0]ホーム

URL:


arguments

package
v1.3.1Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2025 License:GPL-3.0Imports:15Imported by:0

Details

Repository

github.com/arduino/arduino-cli

Links

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

funcAddKeyValuePFlag

func AddKeyValuePFlag(cmd *cobra.Command, field *map[string]string, name, shorthandstring, value []string, usagestring)

AddKeyValuePFlag adds a flag to the command that accepts a (possibly repeated) key=value pair.

funcAskForUserFields

func AskForUserFields(userFields []*rpc.UserField) (map[string]string,error)

AskForUserFields prompts the user to input the provided user fields.If there is an error reading input it panics.

funcCalculateFQBNAndPort

func CalculateFQBNAndPort(ctxcontext.Context, portArgs *Port, fqbnArg *Fqbn, instance *rpc.Instance, srvrpc.ArduinoCoreServiceServer, defaultFQBN, defaultAddress, defaultProtocolstring, profile *rpc.SketchProfile) (string, *rpc.Port)

CalculateFQBNAndPort calculate the FQBN and Port metadata based onparameters provided by the user.This determine the FQBN based on:- the value of the FQBN flag if explicitly specified, otherwise- the FQBN of the selected profile if available, 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 flagsIf 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 andterminates the execution

funcCheckFlagsConflicts

func CheckFlagsConflicts(command *cobra.Command, flagNames ...string)

CheckFlagsConflicts is a helper function useful to report errors when more than one conflicting flag is used

funcCheckFlagsMandatory

func CheckFlagsMandatory(command *cobra.Command, flagNames ...string)

CheckFlagsMandatory is a helper function useful to report errors when at least one flag is not used in a group of "required" flags

funcGetAvailablePorts

func GetAvailablePorts(ctxcontext.Context, srvrpc.ArduinoCoreServiceServer) []*rpc.Port

GetAvailablePorts is an helper function useful to autocomplete.It returns a list of upload port of the boards which are currently connected.It will not suggests network ports because the timeout is not set.

funcGetInstallableCores

func GetInstallableCores(ctxcontext.Context, srvrpc.ArduinoCoreServiceServer) []string

GetInstallableCores is an helper function useful to autocomplete.It returns a list of cores which can be installed/downloaded

funcGetInstallableLibs

func GetInstallableLibs(ctxcontext.Context, srvrpc.ArduinoCoreServiceServer) []string

GetInstallableLibs is an helper function useful to autocomplete.It returns a list of libs which can be installed/downloaded

funcGetInstalledBoards

func GetInstalledBoards(ctxcontext.Context, srvrpc.ArduinoCoreServiceServer) []string

GetInstalledBoards is an helper function useful to autocomplete.It returns a list of fqbnit's taken from cli/board/listall.go

funcGetInstalledLibraries

func GetInstalledLibraries(ctxcontext.Context, srvrpc.ArduinoCoreServiceServer) []string

GetInstalledLibraries is an helper function useful to autocomplete.It returns a list of libs which are currently installed, including the builtin ones

funcGetInstalledProgrammers

func GetInstalledProgrammers(ctxcontext.Context, srvrpc.ArduinoCoreServiceServer) []string

GetInstalledProgrammers is an helper function useful to autocomplete.It returns a list of programmers available based on the installed boards

funcGetSketchProfilesadded inv1.0.0

func GetSketchProfiles(ctxcontext.Context, srvrpc.ArduinoCoreServiceServer, sketchPathstring) []string

GetSketchProfiles is an helper function useful to autocomplete.It returns the profile names set in the sketch.yaml

funcGetUninstallableCores

func GetUninstallableCores(ctxcontext.Context, srvrpc.ArduinoCoreServiceServer) []string

GetUninstallableCores is an helper function useful to autocomplete.It returns a list of cores which can be uninstalled

funcGetUninstallableLibraries

func GetUninstallableLibraries(ctxcontext.Context, srvrpc.ArduinoCoreServiceServer) []string

GetUninstallableLibraries is an helper function useful to autocomplete.It returns a list of libs which can be uninstalled

funcInitSketchPath

func InitSketchPath(pathstring) (sketchPath *paths.Path)

InitSketchPath returns an instance of paths.Path pointing to sketchPath.If sketchPath is an empty string returns the current working directory.

Types

typeDiscoveryTimeout

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

Get returns the timeout

typeFqbn

type Fqbn struct {// contains filtered or unexported fields}

Fqbn contains the fqbn flag data.This is useful so all flags used by commands that needthis information are consistent with each other.

func (*Fqbn)AddToCommand

func (f *Fqbn) AddToCommand(cmd *cobra.Command, srvrpc.ArduinoCoreServiceServer)

AddToCommand adds the flags used to set fqbn to the specified Command

func (*Fqbn)Set

func (f *Fqbn) Set(fqbnstring)

Set sets the fqbn

func (*Fqbn)String

func (f *Fqbn) String()string

String returns the fqbn with the board options if there are any

typePort

type Port struct {// contains filtered or unexported fields}

Port contains the port arguments result.This is useful so all flags used by commands that needthis information are consistent with each other.

func (*Port)AddToCommand

func (p *Port) AddToCommand(cmd *cobra.Command, srvrpc.ArduinoCoreServiceServer)

AddToCommand adds the flags used to set port and protocol to the specified Command

func (*Port)DetectFQBN

func (p *Port) DetectFQBN(ctxcontext.Context, inst *rpc.Instance, srvrpc.ArduinoCoreServiceServer) (string, *rpc.Port,error)

DetectFQBN tries to identify the board connected to the port and returns thediscovered Port object together with the FQBN. If the port does not matchexactly 1 board,

func (*Port)GetPort

func (p *Port) GetPort(ctxcontext.Context, instance *rpc.Instance, srvrpc.ArduinoCoreServiceServer, defaultAddress, defaultProtocolstring, profile *rpc.SketchProfile) (*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(ctxcontext.Context, instance *rpc.Instance, srvrpc.ArduinoCoreServiceServer, defaultAddress, defaultProtocolstring, profile *rpc.SketchProfile) (string,string,error)

GetPortAddressAndProtocol returns only the port address and the port protocolwithout 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

func (p *Port) GetSearchTimeout()time.Duration

GetSearchTimeout returns the timeout

func (*Port)IsPortFlagSetadded inv1.0.0

func (p *Port) IsPortFlagSet()bool

IsPortFlagSet returns true if the port address is provided

typePrePostScriptsFlags

type PrePostScriptsFlags struct {// contains filtered or unexported fields}

PrePostScriptsFlags contains flags data used by the core install and the upgrade commandThis is useful so all flags used by commands that needthis information are consistent with each other.

func (*PrePostScriptsFlags)AddToCommand

func (p *PrePostScriptsFlags) AddToCommand(cmd *cobra.Command)

AddToCommand adds flags that can be used to force running or skippingof post installation scripts

func (*PrePostScriptsFlags)DetectSkipPostInstallValue

func (p *PrePostScriptsFlags) DetectSkipPostInstallValue()bool

DetectSkipPostInstallValue returns true if a post install script must be run

func (*PrePostScriptsFlags)DetectSkipPreUninstallValue

func (p *PrePostScriptsFlags) DetectSkipPreUninstallValue()bool

DetectSkipPreUninstallValue returns true if a post install script must be run

func (*PrePostScriptsFlags)GetRunPostInstall

func (p *PrePostScriptsFlags) GetRunPostInstall()bool

GetRunPostInstall returns the run-post-install flag value

func (*PrePostScriptsFlags)GetRunPreUninstall

func (p *PrePostScriptsFlags) GetRunPreUninstall()bool

GetRunPreUninstall returns the run-post-install flag value

func (*PrePostScriptsFlags)GetSkipPostInstall

func (p *PrePostScriptsFlags) GetSkipPostInstall()bool

GetSkipPostInstall returns the skip-post-install flag value

func (*PrePostScriptsFlags)GetSkipPreUninstall

func (p *PrePostScriptsFlags) GetSkipPreUninstall()bool

GetSkipPreUninstall returns the skip-post-install flag value

typeProfile

type Profile struct {// contains filtered or unexported fields}

Profile contains the profile flag data.This is useful so all flags used by commands that needthis information are consistent with each other.

func (*Profile)AddToCommand

func (f *Profile) AddToCommand(cmd *cobra.Command, srvrpc.ArduinoCoreServiceServer)

AddToCommand adds the flags used to set fqbn to the specified Command

func (*Profile)Get

func (f *Profile) Get()string

Get returns the profile name

func (*Profile)Set

func (f *Profile) Set(profilestring)

Set sets the profile

func (*Profile)String

func (f *Profile) String()string

String returns the profile name

typeProgrammer

type Programmer struct {// contains filtered or unexported fields}

Programmer contains the programmer flag data.This is useful so all flags used by commands that needthis information are consistent with each other.

func (*Programmer)AddToCommand

func (p *Programmer) AddToCommand(cmd *cobra.Command, srvrpc.ArduinoCoreServiceServer)

AddToCommand adds the flags used to set the programmer to the specified Command

func (*Programmer)GetProgrammeradded inv1.0.0

func (p *Programmer) GetProgrammer()string

GetProgrammer returns the programmer specified by the user

func (*Programmer)String

String returns the programmer specified by the user, or the default programmerfor the given board if defined.

typeReference

type Reference struct {PackageNamestringArchitecturestringVersionstring}

Reference represents a reference item (core or library) passed to the CLIinterface

funcParseReference

func ParseReference(ctxcontext.Context, srvrpc.ArduinoCoreServiceServer, argstring) (*Reference,error)

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/arduino/arduino-cli/commands/core.GetPlatformNote that the Reference is returned rightaway if the arg inserted by the user matches perfectly one in the response of core.GetPlatformA MultiplePlatformsError is returned if the platform searched by the user matches multiple platforms

funcParseReferences

func ParseReferences(ctxcontext.Context, srvrpc.ArduinoCoreServiceServer, args []string) ([]*Reference,error)

ParseReferences is a convenient wrapper that operates on a slice of strings andcalls ParseReference for each of them. It returns at the first invalid argument.

func (*Reference)String

func (r *Reference) String()string

typeShowProperties

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

Get returns the corresponding ShowProperties value.

typeShowPropertiesMode

type ShowPropertiesModeint

ShowPropertiesMode represents the possible values of the --show-properties flag.

const (// ShowPropertiesDisabled means that the --show-properties flag has not been usedShowPropertiesDisabledShowPropertiesMode =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)

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp