mirror of
https://github.com/holos-run/holos.git
synced 2026-03-20 09:15:02 +00:00
The `holos render platform` command is unimplemented. This patch partially implements platform rendering by fetching the platform model from the PlatformService and providing it to CUE using a tag. CUE returns a `kind: Platform` resource to `holos` which will eventually process a Buildlan for each platform component listed in the Platform spec. For now, however, it's sufficient to have the current platform model available to CUE.
72 lines
1.2 KiB
Go
72 lines
1.2 KiB
Go
// Package client provides client configuration for the holos cli.
|
|
package client
|
|
|
|
import (
|
|
"context"
|
|
"flag"
|
|
|
|
"github.com/holos-run/holos/internal/holos"
|
|
"github.com/holos-run/holos/internal/token"
|
|
)
|
|
|
|
func NewConfig(cfg *holos.Config) *Config {
|
|
return &Config{
|
|
holos: cfg,
|
|
client: holos.NewClientConfig(),
|
|
context: holos.NewClientContext(context.Background()),
|
|
token: token.NewConfig(),
|
|
}
|
|
}
|
|
|
|
type Config struct {
|
|
holos *holos.Config
|
|
client *holos.ClientConfig
|
|
context *holos.ClientContext
|
|
token *token.Config
|
|
}
|
|
|
|
func (c *Config) ClientFlagSet() *flag.FlagSet {
|
|
if c == nil {
|
|
return nil
|
|
}
|
|
return c.client.FlagSet()
|
|
}
|
|
|
|
func (c *Config) TokenFlagSet() *flag.FlagSet {
|
|
if c == nil {
|
|
return nil
|
|
}
|
|
return c.token.FlagSet()
|
|
}
|
|
|
|
func (c *Config) Token() *token.Config {
|
|
if c == nil {
|
|
return nil
|
|
}
|
|
return c.token
|
|
}
|
|
|
|
func (c *Config) Client() *holos.ClientConfig {
|
|
if c == nil {
|
|
return nil
|
|
}
|
|
return c.client
|
|
}
|
|
|
|
// Context returns the ClientContext useful to get the OrgID and UserID for rpc
|
|
// calls.
|
|
func (c *Config) Context() *holos.ClientContext {
|
|
if c == nil {
|
|
return nil
|
|
}
|
|
return c.context
|
|
}
|
|
|
|
// Holos returns the *holos.Config
|
|
func (c *Config) Holos() *holos.Config {
|
|
if c == nil {
|
|
return nil
|
|
}
|
|
return c.holos
|
|
}
|