cli

package
v0.29.2 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2024 License: AGPL-3.0 Imports: 72 Imported by: 0

README

[EXPERIMENTAL] Viam Command Line Interface

This is an experimental feature, so things may change without notice. All feedback on the cli is greatly appreciated.

Getting Started

Enter viam login and follow instructions to authenticate.

Installation

With brew (macOS & linux amd64):

brew tap viamrobotics/brews
brew install viam

As a binary (linux amd64):

sudo curl -o /usr/local/bin/viam https://storage.googleapis.com/packages.viam.com/apps/viam-cli/viam-cli-stable-linux-amd64
sudo chmod a+rx /usr/local/bin/viam

As a binary (linux arm64):

sudo curl -o /usr/local/bin/viam https://storage.googleapis.com/packages.viam.com/apps/viam-cli/viam-cli-stable-linux-arm64
sudo chmod a+rx /usr/local/bin/viam

From source (you must install go first):

go install go.viam.com/rdk/cli/viam@latest
# add go binaries to your path (if you haven't already)
echo 'export PATH="$HOME/go/bin:$PATH"' >> ~/.bashrc

Development

Building (you must install go first):

go build -o ~/go/bin/viam cli/viam/main.go

Documentation

Overview

Package cli contains all business logic needed by the CLI command.

Index

Constants

View Source
const (
	ModelTypeUnspecified               = ModelType("unspecified")
	ModelTypeSingleLabelClassification = ModelType("single_label_classification")
	ModelTypeMultiLabelClassification  = ModelType("multi_label_classification")
	ModelTypeObjectDetection           = ModelType("object_detection")
)

ModelType enumeration.

View Source
const (
	ModelFrameworkUnspecified = ModelFramework("unspecified")
	ModelFrameworkTFLite      = ModelFramework("tflite")
	ModelFrameworkTensorFlow  = ModelFramework("tensorflow")
	ModelFrameworkPyTorch     = ModelFramework("pytorch")
	ModelFrameworkONNX        = ModelFramework("onnx")
)

ModelFramework enumeration.

View Source
const (
	PackageTypeUnspecified = PackageType("unspecified")
	PackageTypeArchive     = PackageType("archive")
	PackageTypeMLModel     = PackageType("ml_model")
	PackageTypeModule      = PackageType("module")
	PackageTypeSLAMMap     = PackageType("slam_map")
	PackageTypeMLTraining  = PackageType("ml_training")
)

PackageType enumeration.

Variables

This section is empty.

Functions

func CheckUpdateAction added in v0.22.0

func CheckUpdateAction(c *cli.Context) error

CheckUpdateAction is the corresponding Action for 'check-update'.

func CreateModuleAction added in v0.7.3

func CreateModuleAction(c *cli.Context) error

CreateModuleAction is the corresponding Action for 'module create'. It runs the command to create a module. This includes both a gRPC call to register the module on app.viam.com and creating the manifest file.

func DataAddToDatasetByFilter added in v0.16.0

func DataAddToDatasetByFilter(c *cli.Context) error

DataAddToDatasetByFilter is the corresponding action for 'data dataset add filter'.

func DataAddToDatasetByIDs added in v0.16.0

func DataAddToDatasetByIDs(c *cli.Context) error

DataAddToDatasetByIDs is the corresponding action for 'data dataset add ids'.

func DataCancelTrainingJob added in v0.11.0

func DataCancelTrainingJob(c *cli.Context) error

DataCancelTrainingJob is the corresponding action for 'data train cancel'.

func DataConfigureDatabaseUser added in v0.13.0

func DataConfigureDatabaseUser(c *cli.Context) error

DataConfigureDatabaseUser is the corresponding action for 'data database configure'.

func DataDeleteBinaryAction added in v0.8.0

func DataDeleteBinaryAction(c *cli.Context) error

DataDeleteBinaryAction is the corresponding action for 'data delete'.

func DataDeleteTabularAction added in v0.8.0

func DataDeleteTabularAction(c *cli.Context) error

DataDeleteTabularAction is the corresponding action for 'data delete-tabular'.

func DataExportAction added in v0.7.3

func DataExportAction(c *cli.Context) error

DataExportAction is the corresponding action for 'data export'.

func DataGetDatabaseConnection added in v0.13.0

func DataGetDatabaseConnection(c *cli.Context) error

DataGetDatabaseConnection is the corresponding action for 'data database hostname'.

func DataGetTrainingJob added in v0.11.0

func DataGetTrainingJob(c *cli.Context) error

DataGetTrainingJob is the corresponding action for 'data train get'.

func DataListTrainingJobs added in v0.11.0

func DataListTrainingJobs(c *cli.Context) error

DataListTrainingJobs is the corresponding action for 'data train list'.

func DataRemoveFromDataset added in v0.10.0

func DataRemoveFromDataset(c *cli.Context) error

DataRemoveFromDataset is the corresponding action for 'data dataset remove'.

func DataTagActionByFilter added in v0.24.0

func DataTagActionByFilter(c *cli.Context) error

DataTagActionByFilter is the corresponding action for 'data tag filter'.

func DataTagActionByIds added in v0.24.0

func DataTagActionByIds(c *cli.Context) error

DataTagActionByIds is the corresponding action for 'data tag'.

func DatasetCreateAction added in v0.10.0

func DatasetCreateAction(c *cli.Context) error

DatasetCreateAction is the corresponding action for 'dataset create'.

func DatasetDeleteAction added in v0.10.0

func DatasetDeleteAction(c *cli.Context) error

DatasetDeleteAction is the corresponding action for 'dataset rename'.

func DatasetListAction added in v0.10.0

func DatasetListAction(c *cli.Context) error

DatasetListAction is the corresponding action for 'dataset list'.

func DatasetRenameAction added in v0.10.0

func DatasetRenameAction(c *cli.Context) error

DatasetRenameAction is the corresponding action for 'dataset rename'.

func Errorf added in v0.7.3

func Errorf(w io.Writer, format string, a ...interface{})

Errorf prints a message prefixed with a bold red "Error: " prefix and exits with 1. It also capitalizes the first letter of the message.

func GetAuthApplicationAction added in v0.29.0

func GetAuthApplicationAction(c *cli.Context) error

GetAuthApplicationAction is the corresponding action for 'auth-app get'.

func ListLocationsAction added in v0.7.3

func ListLocationsAction(c *cli.Context) error

ListLocationsAction is the corresponding Action for 'locations list'.

func ListOrganizationsAction added in v0.7.3

func ListOrganizationsAction(cCtx *cli.Context) error

ListOrganizationsAction is the corresponding Action for 'organizations list'.

func ListRobotsAction added in v0.7.3

func ListRobotsAction(c *cli.Context) error

ListRobotsAction is the corresponding Action for 'machines list'.

func LocationAPIKeyCreateAction added in v0.11.0

func LocationAPIKeyCreateAction(cCtx *cli.Context) error

LocationAPIKeyCreateAction corresponds to `location api-key create`.

func LoginAction added in v0.7.3

func LoginAction(cCtx *cli.Context) error

LoginAction is the corresponding Action for 'login'.

func LoginWithAPIKeyAction added in v0.9.0

func LoginWithAPIKeyAction(cCtx *cli.Context) error

LoginWithAPIKeyAction is the corresponding Action for `login api-key`.

func LogoutAction added in v0.7.3

func LogoutAction(cCtx *cli.Context) error

LogoutAction is the corresponding Action for 'logout'.

func MLSubmitCustomTrainingJob added in v0.27.0

func MLSubmitCustomTrainingJob(c *cli.Context) error

MLSubmitCustomTrainingJob is the corresponding action for 'train submit-custom'.

func MLSubmitCustomTrainingJobWithUpload added in v0.28.0

func MLSubmitCustomTrainingJobWithUpload(c *cli.Context) error

MLSubmitCustomTrainingJobWithUpload is the corresponding action for 'train submit-custom'.

func MLSubmitTrainingJob added in v0.27.0

func MLSubmitTrainingJob(c *cli.Context) error

MLSubmitTrainingJob is the corresponding action for 'train submit'.

func MLTrainingUpdateAction added in v0.29.0

func MLTrainingUpdateAction(c *cli.Context) error

MLTrainingUpdateAction updates the visibility of training scripts.

func MLTrainingUploadAction added in v0.26.0

func MLTrainingUploadAction(c *cli.Context) error

MLTrainingUploadAction uploads a new custom training script.

func MachinesPartCopyFilesAction added in v0.27.0

func MachinesPartCopyFilesAction(c *cli.Context) error

MachinesPartCopyFilesAction is the corresponding Action for 'machines part cp'.

func ModuleBuildListAction added in v0.17.0

func ModuleBuildListAction(cCtx *cli.Context) error

ModuleBuildListAction lists the module's build jobs.

func ModuleBuildLocalAction added in v0.15.0

func ModuleBuildLocalAction(cCtx *cli.Context) error

ModuleBuildLocalAction runs the module's build commands locally.

func ModuleBuildLogsAction added in v0.17.0

func ModuleBuildLogsAction(c *cli.Context) error

ModuleBuildLogsAction retrieves the logs for a specific build step.

func ModuleBuildStartAction added in v0.17.0

func ModuleBuildStartAction(cCtx *cli.Context) error

ModuleBuildStartAction starts a cloud build.

func NewApp added in v0.7.3

func NewApp(out, errOut io.Writer) *cli.App

NewApp returns a new app with the CLI API, Writer set to out, and ErrWriter set to errOut.

func OrganizationsAPIKeyCreateAction added in v0.9.0

func OrganizationsAPIKeyCreateAction(cCtx *cli.Context) error

OrganizationsAPIKeyCreateAction corresponds to `organizations api-key create`.

func PackageExportAction added in v0.26.0

func PackageExportAction(c *cli.Context) error

PackageExportAction is the corresponding action for 'package export'.

func PackageUploadAction added in v0.28.0

func PackageUploadAction(c *cli.Context) error

PackageUploadAction is the corresponding action for "packages upload".

func PrintAccessTokenAction added in v0.7.3

func PrintAccessTokenAction(cCtx *cli.Context) error

PrintAccessTokenAction is the corresponding Action for 'print-access-token'.

func RegisterAuthApplicationAction added in v0.28.0

func RegisterAuthApplicationAction(c *cli.Context) error

RegisterAuthApplicationAction is the corresponding action for 'auth-app register'.

func ReloadModuleAction added in v0.26.0

func ReloadModuleAction(c *cli.Context) error

ReloadModuleAction builds a module, configures it on a robot, and starts or restarts it.

func RobotAPIKeyCreateAction added in v0.11.0

func RobotAPIKeyCreateAction(cCtx *cli.Context) error

RobotAPIKeyCreateAction corresponds to `machine api-key create`.

func RobotsLogsAction added in v0.9.0

func RobotsLogsAction(c *cli.Context) error

RobotsLogsAction is the corresponding Action for 'machines logs'.

func RobotsPartLogsAction added in v0.9.0

func RobotsPartLogsAction(c *cli.Context) error

RobotsPartLogsAction is the corresponding Action for 'machines part logs'.

func RobotsPartRunAction added in v0.9.0

func RobotsPartRunAction(c *cli.Context) error

RobotsPartRunAction is the corresponding Action for 'machines part run'.

func RobotsPartShellAction added in v0.9.0

func RobotsPartShellAction(c *cli.Context) error

RobotsPartShellAction is the corresponding Action for 'machines part shell'.

func RobotsPartStatusAction added in v0.9.0

func RobotsPartStatusAction(c *cli.Context) error

RobotsPartStatusAction is the corresponding Action for 'machines part status'.

func RobotsStatusAction added in v0.9.0

func RobotsStatusAction(c *cli.Context) error

RobotsStatusAction is the corresponding Action for 'machines status'.

func UpdateAuthApplicationAction added in v0.28.0

func UpdateAuthApplicationAction(c *cli.Context) error

UpdateAuthApplicationAction is the corresponding action for 'auth-app update'.

func UpdateModelsAction added in v0.12.0

func UpdateModelsAction(c *cli.Context) error

UpdateModelsAction figures out the models that a module supports and updates it's metadata file.

func UpdateModuleAction added in v0.7.3

func UpdateModuleAction(c *cli.Context) error

UpdateModuleAction is the corresponding Action for 'module update'. It runs the command to update a module. This includes updating the meta.json to include the public namespace (if set on the org).

func UploadModuleAction added in v0.7.3

func UploadModuleAction(c *cli.Context) error

UploadModuleAction is the corresponding action for 'module upload'.

func VersionAction added in v0.7.3

func VersionAction(c *cli.Context) error

VersionAction is the corresponding Action for 'version'.

func WhoAmIAction added in v0.7.3

func WhoAmIAction(cCtx *cli.Context) error

WhoAmIAction is the corresponding Action for 'whoami'.

Types

type AliasStringFlag added in v0.17.0

type AliasStringFlag struct {
	cli.StringFlag
}

AliasStringFlag returns f.Name as the last member of Names(), which is useful if aliases shouldn't be exposed to the user. Otherwise it is the same as cli.StringFlag.

func (AliasStringFlag) Names added in v0.17.0

func (f AliasStringFlag) Names() []string

Names have to be overwritten to prevent required flag errors from using aliases in its message. This returns f.Name as the last member of Names(), which is what the required flag error uses in its message.

type Config

type Config struct {
	BaseURL         string     `json:"base_url"`
	Auth            authMethod `json:"auth"`
	LastUpdateCheck string     `json:"last_update_check"`
	LatestVersion   string     `json:"latest_version"`
}

Config is the schema for saved CLI credentials.

func ConfigFromCache added in v0.29.0

func ConfigFromCache() (*Config, error)

ConfigFromCache parses the cached json into a Config. TODO(RSDK-7812): maybe move shared code to common location.

func (*Config) DialOptions added in v0.29.0

func (conf *Config) DialOptions() ([]rpc.DialOption, error)

DialOptions constructs an rpc.DialOption slice from config.

type MLMetadata added in v0.26.0

type MLMetadata struct {
	Draft     bool
	ModelType string
	Framework string
}

MLMetadata struct stores package info for ML training packages.

type ModelFramework added in v0.26.0

type ModelFramework string

ModelFramework refers to the backend framework of the model.

type ModelType added in v0.26.0

type ModelType string

ModelType refers to the type of the model.

type ModuleComponent added in v0.5.0

type ModuleComponent struct {
	API   string `json:"api"`
	Model string `json:"model"`
}

ModuleComponent represents an api - model pair.

type ModuleMap added in v0.26.0

type ModuleMap map[string]any

ModuleMap is a type alias to indicate where a map represents a module config. We don't convert to rdkConfig.Module because it can get out of date with what's in the db. Using maps directly also saves a lot of high-maintenance ser/des work.

type PackageType added in v0.26.0

type PackageType string

PackageType refers to the type of the package.

Directories

Path Synopsis
Package main is the CLI command itself.
Package main is the CLI command itself.

Jump to

Keyboard shortcuts

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