Documentation
¶
Overview ¶
Package runtime is the proto-free half of the Metalhost CLI library.
It exposes:
- Options / Profile aliases consumers need
- NewRootCommand — builds a BARE cobra root (persistent flags + version + profile management). No customer commands are attached here, and no SDK gen/aes/* packages are imported transitively.
- Runtime helpers (RuntimeFromCommand, SDKConfig, Write) for callers that want to make API calls themselves once authenticated.
The customer-facing CLI (`metalhost` binary) wraps this package in pkg/metalhostcli, which adds the full vm/disk/network/... command tree.
Internal admin tools (the `mh` binary in the Metalhost backend repo) import this package directly to avoid pulling in customer proto descriptors and triggering a duplicate-registration panic — the backend already has its own generated copy of those proto packages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRootCommand ¶
NewRootCommand returns a bare cobra root command — persistent flags, plus the truly common subcommands (`version`, `profile`). Callers attach their own command tree on top.
Types ¶
type Options ¶
type Options struct {
// Use is the cobra Use string (binary name).
Use string
// Short is the one-line description shown in --help.
Short string
// UserAgent is sent on outgoing API calls. Falls back to a derived value.
UserAgent string
}
Options configures the bare cobra root produced by NewRootCommand.
type Profile ¶
Profile is re-exported for callers that want to type Profile pointers without depending on internal/config directly.
type Runtime ¶
Runtime carries the active profile + the user-agent string for outgoing requests. Build one with RuntimeFromCommand at the start of a RunE handler.
func RuntimeFromCommand ¶
RuntimeFromCommand reads the persistent flags off the root command and builds a Runtime tied to the active profile. RunE handlers should call this first; surface its error to the user.