commands

package
v1.48.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: MIT Imports: 47 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, config map[string]interface{}) (*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 FirmwareExtractCmd added in v1.43.3

func FirmwareExtractCmd() *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 interface {
	ID() string
	Name() string
	Chip() string
	SDKVersion() string
	WordSize() int
	Address() string
	Short() string
	String() string

	SetID(string)
	SetSDKVersion(string)

	Ping(ctx context.Context, sdk *SDK) bool
	SendCode(ctx context.Context, sdk *SDK, request string, b []byte, headersMap map[string]string) error
	ContainerList(ctx context.Context, sdk *SDK) (map[string]string, error)
	ContainerUninstall(ctx context.Context, sdk *SDK, name string) error
	UpdateFirmware(ctx context.Context, sdk *SDK, b []byte) error

	ToJson() map[string]interface{}
}

func GetDevice

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

func NewDeviceFromJson added in v1.42.0

func NewDeviceFromJson(data map[string]interface{}) (Device, error)

func ScanNetwork added in v1.42.0

func ScanNetwork(ctx context.Context, ds deviceSelect, port uint) ([]Device, error)

type DeviceBase added in v1.42.0

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

func (DeviceBase) Address added in v1.42.0

func (d DeviceBase) Address() string

func (DeviceBase) Chip added in v1.42.0

func (d DeviceBase) Chip() string

func (DeviceBase) ID added in v1.42.0

func (d DeviceBase) ID() string

func (DeviceBase) Name added in v1.42.0

func (d DeviceBase) Name() string

func (DeviceBase) SDKVersion added in v1.42.0

func (d DeviceBase) SDKVersion() string

func (DeviceBase) SetID added in v1.42.0

func (d DeviceBase) SetID(id string)

func (DeviceBase) SetSDKVersion added in v1.42.0

func (d DeviceBase) SetSDKVersion(version string)

func (DeviceBase) Short added in v1.42.0

func (d DeviceBase) Short() string

func (DeviceBase) String added in v1.42.0

func (d DeviceBase) String() string

func (DeviceBase) WordSize added in v1.42.0

func (d DeviceBase) WordSize() int

type DeviceNetwork added in v1.42.0

type DeviceNetwork struct {
	DeviceBase
	// contains filtered or unexported fields
}

func NewDeviceNetworkFromJson added in v1.42.0

func NewDeviceNetworkFromJson(data map[string]interface{}) (*DeviceNetwork, error)

func (DeviceNetwork) ContainerList added in v1.42.0

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

func (DeviceNetwork) ContainerUninstall added in v1.42.0

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

func (DeviceNetwork) Ping added in v1.42.0

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

func (DeviceNetwork) SendCode added in v1.42.0

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

func (DeviceNetwork) String added in v1.42.0

func (d DeviceNetwork) String() string

func (DeviceNetwork) ToJson added in v1.42.0

func (d DeviceNetwork) ToJson() map[string]interface{}

func (DeviceNetwork) UpdateFirmware added in v1.42.0

func (d DeviceNetwork) 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
}

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) 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) SnapshotToImage added in v1.4.2

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

func (*SDK) Stacktrace added in v1.4.2

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

func (*SDK) SystemMessage added in v1.4.2

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

func (*SDK) ToitAnalyze added in v1.46.0

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

func (*SDK) ToitCompile added in v0.5.1

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

func (*SDK) ToitLsp added in v0.3.0

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

func (*SDK) ToitPath added in v1.40.0

func (s *SDK) ToitPath() string

func (*SDK) ToitRun added in v0.5.1

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

func (*SDK) ToitRunSnapshot added in v1.43.3

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

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
JackTT - Gopher 🇻🇳