cmdutil

package
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfirmPrompt

func ConfirmPrompt(msg, help string, def bool) (bool, error)

func HasRillProject added in v0.50.0

func HasRillProject(dir string) bool

func InputPrompt

func InputPrompt(msg, def string) (string, error)

func RepoForProjectPath added in v0.36.0

func RepoForProjectPath(path string) (drivers.RepoStore, string, error)

RepoForProjectPath creates an ad-hoc drivers.RepoStore for a local project file path

func SelectPrompt

func SelectPrompt(msg string, options []string, def string) (string, error)

func SelectPromptIfEmpty

func SelectPromptIfEmpty(input *string, msg string, options []string, def string) error

func SetFlagsByInputPrompts added in v0.26.0

func SetFlagsByInputPrompts(cmd cobra.Command, flags ...string) error

func StringPromptIfEmpty

func StringPromptIfEmpty(input *string, msg string) error

func UploadRepo added in v0.47.0

func UploadRepo(ctx context.Context, repo drivers.RepoStore, ch *Helper, org, name string) (string, error)

UploadRepo uploads a local project files to rill managed store. Internally it creates an asset object on admin service and returns its id which can be supplied while creating/updating project.

Types

type Helper added in v0.38.0

type Helper struct {
	*printer.Printer
	Version            Version
	Interactive        bool
	Org                string
	AdminURLDefault    string
	AdminURLOverride   string
	AdminTokenDefault  string
	AdminTokenOverride string
	// contains filtered or unexported fields
}

func (*Helper) AdminToken added in v0.42.0

func (h *Helper) AdminToken() string

func (*Helper) AdminURL added in v0.42.0

func (h *Helper) AdminURL() string

func (*Helper) Client added in v0.42.0

func (h *Helper) Client() (*client.Client, error)

func (*Helper) Close added in v0.42.0

func (h *Helper) Close() error

func (*Helper) CurrentUserID added in v0.42.0

func (h *Helper) CurrentUserID(ctx context.Context) (string, error)

CurrentUserID fetches the ID of the current user. It caches the result in ~/.rill, along with a hash of the current admin token for cache invalidation in case of login/logout.

func (*Helper) InferProjectName added in v0.42.0

func (h *Helper) InferProjectName(ctx context.Context, org, path string) (string, error)

func (*Helper) IsAuthenticated added in v0.42.0

func (h *Helper) IsAuthenticated() bool

func (*Helper) IsDev added in v0.42.0

func (h *Helper) IsDev() bool

func (*Helper) LoadProject added in v0.49.0

func (h *Helper) LoadProject(ctx context.Context, path string) (*adminv1.Project, error)

LoadProject loads the cloud project identified by the .rillcloud directory at the given path. It returns an error if the caller is not authenticated. If there is no .rillcloud directory, it returns a nil project an no error.

func (*Helper) OpenRuntimeClient added in v0.49.0

func (h *Helper) OpenRuntimeClient(ctx context.Context, org, project string, local bool) (*runtimeclient.Client, string, error)

OpenRuntimeClient opens a client for the production deployment for the given project. If local is true, it connects to the locally running runtime instead of the deployed project's runtime. It returns the runtime client and instance ID for the project.

func (*Helper) ProjectNamesByGithubURL added in v0.42.0

func (h *Helper) ProjectNamesByGithubURL(ctx context.Context, org, githubURL, subPath string) ([]string, error)

func (*Helper) ReloadAdminConfig added in v0.49.0

func (h *Helper) ReloadAdminConfig() error

ReloadAdminConfig populates the helper's AdminURL, AdminTokenDefault, and Org properties from ~/.rill.

func (*Helper) Telemetry added in v0.42.0

func (h *Helper) Telemetry(ctx context.Context) *activity.Client

Telemetry returns a client for recording events. Note: It should only be used for parts of the CLI that run on users' local computer because: a) it accesses ~/.rill and adds information about the current user, b) it sends events to the public intake endpoint instead of directly to Kafka.

type PreRunCheck

type PreRunCheck func(cmd *cobra.Command, args []string) error

func CheckAuth

func CheckAuth(ch *Helper) PreRunCheck

func CheckChain

func CheckChain(chain ...PreRunCheck) PreRunCheck

func CheckOrganization

func CheckOrganization(ch *Helper) PreRunCheck

type Version added in v0.42.0

type Version struct {
	Number    string
	Commit    string
	Timestamp string
}

func (Version) IsDev added in v0.42.0

func (v Version) IsDev() bool

func (Version) String added in v0.42.0

func (v Version) String() string

Jump to

Keyboard shortcuts

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