commands

package
v1.34.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 49 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WifiCfgKey         = "wifi"
	WifiSSIDCfgKey     = "ssid"
	WifiPasswordCfgKey = "password"
)
View Source
const (
	JaguarDeviceIDHeader         = "X-Jaguar-Device-ID"
	JaguarSDKVersionHeader       = "X-Jaguar-SDK-Version"
	JaguarDisabledHeader         = "X-Jaguar-Disabled"
	JaguarContainerNameHeader    = "X-Jaguar-Container-Name"
	JaguarContainerTimeoutHeader = "X-Jaguar-Container-Timeout"
	JaguarCRC32Header            = "X-Jaguar-CRC32"
)
View Source
const (
	MagicToken = "Jag15261520"
)
View Source
const UpToDateKey = "up-to-date"

Variables

This section is empty.

Functions

func BuildFirmwareEnvelope added in v1.6.9

func BuildFirmwareEnvelope(ctx context.Context, envelope EnvelopeOptions, device DeviceOptions, uartEndpointOptions map[string]interface{}) (*os.File, error)

func CheckPort added in v0.1.0

func CheckPort(port string) (string, error)

func CheckUpToDate added in v1.4.4

func CheckUpToDate(info Info)

func CompileCmd added in v1.2.0

func CompileCmd() *cobra.Command

func ConfigAnalyticsCmd added in v0.3.0

func ConfigAnalyticsCmd() *cobra.Command

func ConfigCmd added in v0.3.0

func ConfigCmd(info Info) *cobra.Command

func ConfigUpToDateCmd added in v1.4.4

func ConfigUpToDateCmd(info Info) *cobra.Command

func ConfigWifiCmd added in v1.4.0

func ConfigWifiCmd() *cobra.Command

func ConfiguredPort added in v0.1.0

func ConfiguredPort() string

func ContainerCmd added in v1.5.0

func ContainerCmd() *cobra.Command

func ContainerInstallCmd added in v1.5.0

func ContainerInstallCmd() *cobra.Command

func ContainerListCmd added in v1.5.0

func ContainerListCmd() *cobra.Command

func ContainerUninstallCmd added in v1.5.0

func ContainerUninstallCmd() *cobra.Command

func DecodeCmd

func DecodeCmd() *cobra.Command

func DownloadEnvelope added in v1.30.0

func DownloadEnvelope(ctx context.Context, path string, version string, tmpDir string) (string, error)

func ExtractFirmware added in v1.7.2

func ExtractFirmware(ctx context.Context, sdk *SDK, envelopePath string, format string) (*os.File, error)

func ExtractFirmwareBin added in v1.7.8

func ExtractFirmwareBin(ctx context.Context, sdk *SDK, envelopePath string, config map[string]interface{}) (*os.File, error)

func FirmwareCmd added in v1.2.0

func FirmwareCmd() *cobra.Command

func FirmwareUpdateCmd added in v1.2.0

func FirmwareUpdateCmd() *cobra.Command

func FlashCmd

func FlashCmd() *cobra.Command

func GetCachedFirmwareEnvelopePath added in v1.10.4

func GetCachedFirmwareEnvelopePath(ctx context.Context, version string, model string) (string, error)

GetCachedFirmwareEnvelopePath returns the path to the cached firmware envelope. If necessary, downloads the envelope from the server first.

func GetFirmwareEnvelopeFileName added in v1.10.4

func GetFirmwareEnvelopeFileName(model string) string

func GetPort added in v0.1.0

func GetPort(cfg *viper.Viper, all bool, reset bool) (string, error)

func GetProgramAssetsPath added in v1.6.9

func GetProgramAssetsPath(flags *pflag.FlagSet, flagName string) (string, error)

func GetRandomName added in v0.0.5

func GetRandomName(id []byte) string

func GetUuid added in v1.2.0

func GetUuid(filename string) (uuid.UUID, error)

Get the UUID out of a snapshot file, which is an ar archive.

func InstallFile added in v1.5.2

func InstallFile(
	cmd *cobra.Command,
	device *Device,
	sdk *SDK,
	name string,
	path string,
	defines map[string]interface{},
	assetsPath string,
	optimizationLevel int) error

func IsSnapshot added in v1.2.0

func IsSnapshot(filename string) bool

Checks whether a file is a snapshot file. Starts by checking for an ar file, since snapshot files are ar files.

func JagCmd

func JagCmd(info Info, isReleaseBuild bool) *cobra.Command

func MonitorCmd

func MonitorCmd() *cobra.Command

func PingCmd

func PingCmd() *cobra.Command

func PkgCmd added in v0.3.0

func PkgCmd(info Info) *cobra.Command

func PortCmd added in v0.5.0

func PortCmd() *cobra.Command

func PortExists added in v0.1.0

func PortExists(port string) (bool, error)

func PortSetCmd added in v0.5.0

func PortSetCmd() *cobra.Command

func ReadLine added in v0.1.0

func ReadLine() (string, error)

func ReadPassword added in v0.1.0

func ReadPassword() ([]byte, error)

func RunCmd

func RunCmd() *cobra.Command

func RunFile added in v1.2.1

func RunFile(
	cmd *cobra.Command,
	device *Device,
	sdk *SDK,
	path string,
	defines map[string]interface{},
	assetsPath string,
	optimizationLevel int) error

func ScanCmd

func ScanCmd() *cobra.Command

func SetInfo added in v0.4.0

func SetInfo(ctx context.Context, info Info) context.Context

func SetupCmd

func SetupCmd(info Info) *cobra.Command

func SetupSdkCmd added in v1.6.9

func SetupSdkCmd(info Info) *cobra.Command

func SimulateCmd

func SimulateCmd() *cobra.Command

func ToitCmd added in v0.3.0

func ToitCmd() *cobra.Command

func ToitLspCmd added in v0.3.0

func ToitLspCmd() *cobra.Command

func VersionCmd added in v0.1.0

func VersionCmd(info Info, isReleaseBuild bool) *cobra.Command

func WatchCmd added in v0.1.0

func WatchCmd() *cobra.Command

Types

type Decoder added in v1.4.3

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

func NewDecoder added in v1.27.0

func NewDecoder(scanner *bufio.Scanner, ctx context.Context, envelope string) *Decoder

type Device

type Device struct {
	ID         string `mapstructure:"id" yaml:"id" json:"id"`
	Name       string `mapstructure:"name" yaml:"name" json:"name"`
	Chip       string `mapstructure:"chip" yaml:"chip" json:"chip"`
	Address    string `mapstructure:"address" yaml:"address" json:"address"`
	SDKVersion string `mapstructure:"sdkVersion" yaml:"sdkVersion" json:"sdkVersion"`
	WordSize   int    `mapstructure:"wordSize" yaml:"wordSize" json:"wordSize"`
	Proxied    bool   `mapstructure:"proxied" yaml:"proxied" json:"proxied"`
}

func GetDevice

func GetDevice(ctx context.Context, cfg *viper.Viper, sdk *SDK, checkPing bool, deviceSelect deviceSelect) (*Device, error)

func (Device) ContainerList added in v1.5.0

func (d Device) ContainerList(ctx context.Context, sdk *SDK) (map[string]string, error)

func (Device) ContainerUninstall added in v1.5.0

func (d Device) ContainerUninstall(ctx context.Context, sdk *SDK, name string) error

func (Device) Ping

func (d Device) Ping(ctx context.Context, sdk *SDK) bool

func (Device) SendCode added in v1.5.2

func (d Device) SendCode(ctx context.Context, sdk *SDK, request string, b []byte, headersMap map[string]string) error

func (Device) Short added in v0.5.0

func (d Device) Short() string

func (Device) String

func (d Device) String() string

func (Device) UpdateFirmware added in v1.2.0

func (d Device) UpdateFirmware(ctx context.Context, sdk *SDK, b []byte) error

type DeviceOptions added in v1.7.0

type DeviceOptions struct {
	Id           string
	Name         string
	Chip         string
	WifiSsid     string
	WifiPassword string
}

func (DeviceOptions) GetConfig added in v1.7.2

func (d DeviceOptions) GetConfig() map[string]interface{}

type Devices added in v0.5.0

type Devices struct {
	Devices []Device `mapstructure:"devices" yaml:"devices" json:"devices"`
}

func (Devices) Elements added in v0.5.0

func (d Devices) Elements() []Short

type Elements added in v0.5.0

type Elements interface {
	Elements() []Short
}

type EnvelopeOptions added in v1.7.0

type EnvelopeOptions struct {
	Path          string
	ExcludeJaguar bool
}

type HasDataReader added in v1.25.0

type HasDataReader interface {
	io.Reader
	HasData() bool
}

type Info added in v0.1.0

type Info struct {
	Version    string `mapstructure:"version" yaml:"version" json:"version"`
	Date       string `mapstructure:"date" yaml:"date" json:"date"`
	SDKVersion string `mapstructure:"sdkVersion" yaml:"sdkVersion" json:"sdkVersion"`
}

func GetInfo added in v0.4.0

func GetInfo(ctx context.Context) Info

type Port added in v0.5.0

type Port string

func (Port) Short added in v0.5.0

func (p Port) Short() string

func (Port) String added in v0.5.0

func (p Port) String() string

type Ports added in v0.5.0

type Ports struct {
	Ports []Port `mapstructure:"ports" yaml:"ports" json:"ports"`
}

func (Ports) Elements added in v0.5.0

func (p Ports) Elements() []Short

func (Ports) Len added in v0.5.0

func (p Ports) Len() int

type ProgressReader added in v1.2.3

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

A Reader based on a byte array that prints a progress bar.

func NewProgressReader added in v1.2.3

func NewProgressReader(b []byte) *ProgressReader

func (*ProgressReader) Read added in v1.2.3

func (p *ProgressReader) Read(buffer []byte) (n int, err error)

type SDK

type SDK struct {
	Path    string
	Version string
}

func GetSDK

func GetSDK(ctx context.Context) (*SDK, error)

func (*SDK) AssetsTool added in v1.6.9

func (s *SDK) AssetsTool(ctx context.Context, args ...string) *exec.Cmd

func (*SDK) AssetsToolPath added in v1.6.9

func (s *SDK) AssetsToolPath() string

func (*SDK) Build added in v0.1.0

func (s *SDK) Build(ctx context.Context, device *Device, snapshotPath string, assetsPath string) ([]byte, error)

func (*SDK) Compile added in v1.2.0

func (s *SDK) Compile(ctx context.Context, snapshot string, entrypoint string, optimizationLevel int) error

func (*SDK) DownloaderInfoPath added in v1.0.0

func (s *SDK) DownloaderInfoPath() string

func (*SDK) FirmwareTool added in v1.6.9

func (s *SDK) FirmwareTool(ctx context.Context, args ...string) *exec.Cmd

func (*SDK) FirmwareToolPath added in v1.6.9

func (s *SDK) FirmwareToolPath() string

func (*SDK) SnapshotToImage added in v1.4.2

func (s *SDK) SnapshotToImage(ctx context.Context, args ...string) *exec.Cmd

func (*SDK) SnapshotToImagePath

func (s *SDK) SnapshotToImagePath() string

func (*SDK) Stacktrace added in v1.4.2

func (s *SDK) Stacktrace(ctx context.Context, args ...string) *exec.Cmd

func (*SDK) StacktracePath added in v1.2.5

func (s *SDK) StacktracePath() string

func (*SDK) SystemMessage added in v1.4.2

func (s *SDK) SystemMessage(ctx context.Context, args ...string) *exec.Cmd

func (*SDK) SystemMessagePath added in v1.4.2

func (s *SDK) SystemMessagePath() string

func (*SDK) ToitCompile added in v0.5.1

func (s *SDK) ToitCompile(ctx context.Context, args ...string) *exec.Cmd

func (*SDK) ToitCompilePath added in v0.5.1

func (s *SDK) ToitCompilePath() string

func (*SDK) ToitLsp added in v0.3.0

func (s *SDK) ToitLsp(ctx context.Context, args []string) *exec.Cmd

func (*SDK) ToitLspPath added in v0.3.0

func (s *SDK) ToitLspPath() string

func (*SDK) ToitRun added in v0.5.1

func (s *SDK) ToitRun(ctx context.Context, args ...string) *exec.Cmd

func (*SDK) ToitRunPath added in v0.5.1

func (s *SDK) ToitRunPath() string

func (*SDK) VersionPath added in v0.4.0

func (s *SDK) VersionPath() string

type Short added in v0.5.0

type Short interface {
	Short() string
}

type UpdateToDate added in v1.4.4

type UpdateToDate struct {
	Disabled    bool   `mapstructure:"disabled" yaml:"disabled" json:"disabled"`
	LastSuccess string `mapstructure:"lastSuccess" yaml:"lastSuccess" json:"lastSuccess"`
	LastAttempt string `mapstructure:"lastAttempt" yaml:"lastAttempt" json:"lastAttempt"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL