presenters

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NoDataFound

func NoDataFound(message string)

func OperationCancelled

func OperationCancelled()

func PrintDeletionSummary

func PrintDeletionSummary(results SummaryResults)

func PrintJSON added in v0.7.0

func PrintJSON(v interface{}) error

PrintJSON marshals v to indented JSON and prints to stdout.

func PrintListJSON added in v0.11.0

func PrintListJSON(items interface{}, info PageInfo) error

PrintListJSON emits items as JSON. When info.Truncated is true, items are wrapped in a PaginatedJSON envelope with hint and next_offset. Otherwise the bare items value is emitted (matching the pre-pagination shape).

func PrintQuiet added in v0.7.0

func PrintQuiet(items []string)

PrintQuiet prints each string on its own line to stdout.

func PrintTruncationHint added in v0.11.0

func PrintTruncationHint(w io.Writer, info PageInfo)

PrintTruncationHint writes a one-line truncation hint to stderr (so it does not pollute stdout data streams). It is a no-op if the page was not truncated.

func ProgressCounter

func ProgressCounter(current, total int, action, target string)

func RenderBranch

func RenderBranch(a *app.App, res BranchView)

func RenderCommitCreate added in v0.12.0

func RenderCommitCreate(_ *app.App, v CommitCreateView)

RenderCommitCreate prints the text-mode summary for a `vers commit create` invocation. JSON output is handled separately by pres.PrintJSON.

func RenderCommitParents added in v0.7.0

func RenderCommitParents(_ *app.App, v CommitParentsView)

func RenderCommitsList added in v0.7.0

func RenderCommitsList(_ *app.App, v CommitsListView)

func RenderConnect

func RenderConnect(a *app.App, v ConnectView)

func RenderCopy

func RenderCopy(a *app.App, v CopyView)

func RenderDeploy added in v0.7.2

func RenderDeploy(a *app.App, v DeployView)

RenderDeploy prints human-friendly output for a deploy operation.

func RenderExecute

func RenderExecute(a *app.App, v ExecuteView)

func RenderInfo added in v0.7.0

func RenderInfo(_ *app.App, v InfoView)

func RenderPause

func RenderPause(a *app.App, v PauseView)

func RenderRepoInfo added in v0.8.0

func RenderRepoInfo(_ *app.App, r *vers.RepositoryInfo)

func RenderRepoList added in v0.8.0

func RenderRepoList(_ *app.App, v RepoListView)

func RenderRepoTagInfo added in v0.8.0

func RenderRepoTagInfo(_ *app.App, t *vers.RepoTagInfo)

func RenderRepoTagList added in v0.8.0

func RenderRepoTagList(_ *app.App, v RepoTagListView)

func RenderResume

func RenderResume(a *app.App, v ResumeView)

func RenderRun

func RenderRun(a *app.App, v RunView)

func RenderRunCommit

func RenderRunCommit(a *app.App, v RunCommitView)

func RenderStatus

func RenderStatus(a *app.App, res StatusView)

func RenderTagInfo added in v0.7.0

func RenderTagInfo(_ *app.App, t *vers.TagInfo)

func RenderTagList added in v0.7.0

func RenderTagList(_ *app.App, v TagListView)

func RenderTunnel added in v0.6.0

func RenderTunnel(a *app.App, v TunnelView)

func RenderVMList

func RenderVMList(vms []vers.Vm)

func RenderVMStatus

func RenderVMStatus(vm *vers.Vm)

func SectionHeader

func SectionHeader(title string)

func SuccessMessage

func SuccessMessage(message string)

Types

type BranchView

type BranchView struct {
	FromID       string   `json:"from_id"`
	FromName     string   `json:"from_name,omitempty"`
	NewID        string   `json:"new_id,omitempty"`
	NewIDs       []string `json:"new_ids"`
	NewAlias     string   `json:"new_alias,omitempty"`
	NewState     string   `json:"new_state,omitempty"`
	CheckoutDone bool     `json:"checkout_done,omitempty"`
	CheckoutErr  error    `json:"-"`
	UsedHEAD     bool     `json:"used_head,omitempty"`
}

type CommitCreateView added in v0.12.0

type CommitCreateView struct {
	CommitID    string             `json:"commit_id"`
	VmID        string             `json:"vm_id"`
	UsedHEAD    bool               `json:"used_head,omitempty"`
	Name        string             `json:"name,omitempty"`
	Description string             `json:"description,omitempty"`
	TagsWritten []CommitTagWritten `json:"tags_written,omitempty"`
	// IsPublic reflects the commit's visibility after any --public publish
	// step. Only populated when --public was supplied; otherwise omitted.
	IsPublic bool `json:"is_public,omitempty"`
}

CommitCreateView is the JSON/text-mode shape for `vers commit create`.

type CommitParentsView added in v0.7.0

type CommitParentsView struct {
	CommitID string
	Parents  []vers.CommitListParentsResponse
}

type CommitTagWritten added in v0.12.0

type CommitTagWritten struct {
	Reference string `json:"reference"`
	TagID     string `json:"tag_id"`
}

CommitTagWritten is one entry in CommitCreateView.TagsWritten.

type CommitsListView added in v0.7.0

type CommitsListView struct {
	Commits []vers.CommitInfo
	Total   int64
	Public  bool
}

type ConnectView

type ConnectView struct {
	UsedHEAD   bool
	HeadID     string
	VMName     string
	SSHHost    string
	SSHPort    string
	LocalRoute bool
}

type CopyView

type CopyView struct {
	UsedHEAD bool
	HeadID   string
	VMName   string
	Action   string
	Src      string
	Dest     string
}

type DeployView added in v0.7.2

type DeployView struct {
	ProjectID string `json:"project_id"`
	VmID      string `json:"vm_id"`
	Status    string `json:"status"`
}

DeployView contains the data returned from a deploy operation.

type ExecuteView

type ExecuteView struct {
	UsedHEAD bool
	HeadID   string
	ExitCode int
}

type InfoView added in v0.7.0

type InfoView struct {
	Metadata *vers.VmMetadataResponse
	UsedHEAD bool
}

type OutputFormat added in v0.7.0

type OutputFormat int

OutputFormat controls how command output is rendered.

const (
	FormatDefault OutputFormat = iota
	FormatQuiet                // just IDs/names, one per line
	FormatJSON                 // full JSON
)

func ParseFormat added in v0.7.0

func ParseFormat(quiet bool, jsonFlag bool, formatStr string) (OutputFormat, error)

ParseFormat returns the output format from flag values.

Precedence: quiet > json > format > default. The legacy --format flag is accepted for backwards compatibility but only "json" is valid; any other value returns an enumerated error so agents can self-correct in one retry.

Callers should pass the values of --quiet, --json, and --format directly; deprecation of --format is handled by cobra's MarkDeprecated at the flag registration site, which prints a warning to stderr when --format is used.

type PageInfo added in v0.11.0

type PageInfo struct {
	Total      int    `json:"total"`
	Limit      int    `json:"limit"`
	Offset     int    `json:"offset"`
	Truncated  bool   `json:"truncated"`
	NextOffset *int   `json:"next_offset,omitempty"`
	Hint       string `json:"hint,omitempty"`
}

PageInfo describes pagination metadata for list-style command outputs.

When emitted as JSON, fields with zero values are kept (Total/Limit/Offset) so consumers can rely on a stable shape; NextOffset is omitted when there is no next page.

TODO: Once the underlying API exposes server-side pagination via typed query parameters in the Go SDK, plumb Limit/Offset/Cursor through to the network call instead of trimming the full response client-side. Today the SDK list endpoints do not accept pagination params, so we client-side paginate after the response.

func ApplyPaging added in v0.11.0

func ApplyPaging(total, limit, offset int) (start, end int, info PageInfo)

ApplyPaging clamps the requested offset/limit against a list of length total and returns the slice indices [start, end) along with PageInfo describing the result.

limit == 0 (or negative) means "unbounded": return everything from offset onwards.

type PaginatedJSON added in v0.11.0

type PaginatedJSON struct {
	Items      interface{} `json:"items"`
	Total      int         `json:"total"`
	Limit      int         `json:"limit"`
	Offset     int         `json:"offset"`
	Truncated  bool        `json:"truncated"`
	NextOffset *int        `json:"next_offset,omitempty"`
	Hint       string      `json:"hint,omitempty"`
}

PaginatedJSON is the wire shape used when a list response is truncated. When not truncated, callers should emit the bare items array (preserving pre-pagination output shape for backwards compatibility).

type PauseView

type PauseView struct{ VMName, NewState string }

type RepoListView added in v0.8.0

type RepoListView struct {
	Repositories []vers.RepositoryInfo
}

type RepoTagListView added in v0.8.0

type RepoTagListView struct {
	Repository string
	Tags       []vers.RepoTagInfo
}

type ResumeView

type ResumeView struct{ VMName, NewState string }

type RunCommitView

type RunCommitView struct {
	RootVmID   string `json:"vm_id"`
	HeadTarget string `json:"head,omitempty"`
	CommitKey  string `json:"commit_key"`
}

type RunView

type RunView struct {
	RootVmID   string `json:"vm_id"`
	VmAlias    string `json:"alias,omitempty"`
	HeadTarget string `json:"head,omitempty"`
}

type StatusHead

type StatusHead struct {
	Show        bool
	Present     bool
	Empty       bool
	ID          string
	DisplayName string
	State       string
}

type StatusMode

type StatusMode int
const (
	StatusList StatusMode = iota
	StatusVM
)

type StatusView

type StatusView struct {
	Mode StatusMode
	Head StatusHead
	VM   *vers.Vm
	VMs  []vers.Vm
}

type SummaryResults

type SummaryResults struct {
	SuccessCount int
	FailCount    int
	Errors       []string
	ItemType     string
}

type TagListView added in v0.7.0

type TagListView struct {
	Tags []vers.TagInfo
}

type TunnelView added in v0.6.0

type TunnelView struct {
	UsedHEAD   bool
	HeadID     string
	VMName     string
	LocalPort  int
	RemoteHost string
	RemotePort int
}

TunnelView holds data for rendering tunnel status.

Jump to

Keyboard shortcuts

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