Documentation
¶
Index ¶
- Variables
- func Agent(ctx context.Context, writer io.Writer, opts AgentOptions) error
- func ParameterSchema(cmd *cobra.Command, parameterSchema codersdk.ProjectVersionParameterSchema) (string, error)
- func Prompt(cmd *cobra.Command, opts PromptOptions) (string, error)
- func ProvisionerJob(ctx context.Context, writer io.Writer, opts ProvisionerJobOptions) error
- func Select(cmd *cobra.Command, opts SelectOptions) (string, error)
- func ValidateNotEmpty(s string) error
- func Warn(wtr io.Writer, header string, lines ...string)
- func WorkspaceBuild(ctx context.Context, writer io.Writer, client *codersdk.Client, ...) error
- type AgentOptions
- type PromptOptions
- type ProvisionerJobOptions
- type SelectOptions
Constants ¶
This section is empty.
Variables ¶
View Source
var (
Canceled = xerrors.New("canceled")
)
View Source
var Styles = struct { Bold, Checkmark, Code, Crossmark, Field, Keyword, Paragraph, Placeholder, Prompt, FocusedPrompt, Fuschia, Logo, Warn, Wrap lipgloss.Style }{ Bold: lipgloss.NewStyle().Bold(true), Checkmark: defaultStyles.Checkmark, Code: defaultStyles.Code, Crossmark: defaultStyles.Error.Copy().SetString("✘"), Field: defaultStyles.Code.Copy().Foreground(lipgloss.AdaptiveColor{Light: "#000000", Dark: "#FFFFFF"}), Keyword: defaultStyles.Keyword, Paragraph: defaultStyles.Paragraph, Placeholder: lipgloss.NewStyle().Foreground(lipgloss.Color("240")), Prompt: defaultStyles.Prompt.Foreground(lipgloss.AdaptiveColor{Light: "#9B9B9B", Dark: "#5C5C5C"}), FocusedPrompt: defaultStyles.FocusedPrompt.Foreground(lipgloss.Color("#651fff")), Fuschia: defaultStyles.SelectedMenuItem.Copy(), Logo: defaultStyles.Logo.SetString("Coder"), Warn: lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{Light: "#04B575", Dark: "#ECFD65"}), Wrap: defaultStyles.Wrap, }
Styles compose visual elements of the UI!
Functions ¶
func ParameterSchema ¶
func Prompt ¶
func Prompt(cmd *cobra.Command, opts PromptOptions) (string, error)
Prompt asks the user for input.
func ProvisionerJob ¶
ProvisionerJob renders a provisioner job with interactive cancellation.
func Select ¶
func Select(cmd *cobra.Command, opts SelectOptions) (string, error)
Select displays a list of user options.
func ValidateNotEmpty ¶
ValidateNotEmpty is a helper function to disallow empty inputs!
Types ¶
type AgentOptions ¶
type PromptOptions ¶
type PromptOptions struct { Text string Default string Secret bool IsConfirm bool Validate func(string) error }
PromptOptions supply a set of options to the prompt.
type ProvisionerJobOptions ¶
type ProvisionerJobOptions struct { Fetch func() (codersdk.ProvisionerJob, error) Cancel func() error Logs func() (<-chan codersdk.ProvisionerJobLog, error) FetchInterval time.Duration // Verbose determines whether debug and trace logs will be shown. Verbose bool }
type SelectOptions ¶
Click to show internal directories.
Click to hide internal directories.