Documentation
¶
Overview ¶
Package cliutil provides helpers for building Command Lines.
Index ¶
Constants ¶
View Source
const (
// OutputJSON encodes the output as JSON.
OutputJSON = "json"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type APIClient ¶
type APIClient interface { Accounts() indentv1.AccountAPIClient Blocks() indentv1.BlockAPIClient Petitions() indentv1.PetitionAPIClient Resources() indentv1.ResourceAPIClient Tokens() indentv1.TokenAPIClient Webhooks() indentv1.WebhookAPIClient }
APIClient returns type specific clients.
type Config ¶
type Config struct { // Environment is the environment to use with the CLI. *Environment `mapstructure:"ENVIRONMENT" yaml:"environment"` // Space is the name of the space being used with the CLI. Space string `mapstructure:"SPACE" yaml:"space"` // Staging specifies that the staging environment should be used. Staging bool `mapstructure:"STAGING" yaml:"staging"` // JSONKeyFile specifies a path to a Google Developers service account // JSON key file. If none, then a standard oauth token is expected. JSONKeyFile string `mapstructure:"JSON_KEY_FILE" yaml:"jsonKeyFile"` // Verbose specifies that the logger should include debug messages and additional context. Verbose bool `mapstructure:"VERBOSE" yaml:"verbose"` // Headless specifies that the CLI should not open a browser login window. Headless bool `mapstructure:"HEADLESS" yaml:"headless"` // contains filtered or unexported fields }
Config shared by all commands of the CLI.
type Environment ¶
type Environment struct { // Name of the environment. Name string `yaml:"name"` // Target is the gRPC endpoint dialed to connect. Target string `yaml:"target"` // OAuth contains the configuration used to authenticate with OAuth2. OAuth *oauth2.Config `yaml:"oauth"` }
Environment specifies the Indent environment being connected to.
type Factory ¶
type Factory interface { // Setup readies the factory for use. Setup() // Logger returns a zap.Logger for logging messages in the CLI. Logger() *zap.Logger // Config returns the global configuration of the CLI. Config() *Config // WriteConfig writes the current configuration to disk. WriteConfig() // Store returns a token Store. Store() oauthutil.Store // OutputJSON writes the given proto.Message to stdout as JSON. OutputJSON(proto.Message) // API returns an APIClient configured to use the Platform API. API(context.Context) APIClient // Resources returns all the Resources in the space. Resources(ctx context.Context, view string) *indentv1.ListResourcesResponse // SelectResource uses an interactive prompt to select a resource. SelectResource(ctx context.Context, view string) (selected *auditv1.Resource) // CurrentUser returns a Resource representing the currently logged-in user. CurrentUser(context.Context) *auditv1.Resource // IsLoggedIn returns whether credentials and are active or not IsLoggedIn(context.Context) bool // AppConfigName returns the ConfigName for the space. AppConfigName(context.Context) string }
Factory provides shared configuration used across the CLI.
Click to show internal directories.
Click to hide internal directories.