Documentation
¶
Index ¶
- Variables
- func ConfigureHTTPClient(ctx context.Context, clientCertFile, clientKeyFile string, ...) (context.Context, *http.Client, error)
- func ConfigureTraceProvider(ctx context.Context, logger slog.Logger, cfg *codersdk.DeploymentValues) (trace.TracerProvider, string, func(context.Context) error)
- func ConnectToPostgres(ctx context.Context, logger slog.Logger, driver string, dbURL string) (sqlDB *sql.DB, err error)
- func CurrentOrganization(r *RootCmd, inv *serpent.Invocation, client *codersdk.Client) (codersdk.Organization, error)
- func DiscoverVarsFiles(workDir string) ([]string, error)
- func DumpHandler(ctx context.Context, name string)
- func ExitError(code int, err error) error
- func FormatExamples(examples ...Example) string
- func IsLocalURL(ctx context.Context, u *url.URL) (bool, error)
- func IsLocalhost(host string) bool
- func ParseProvisionerTags(rawTags []string) (map[string]string, error)
- func ParseUserVariableValues(varsFiles []string, variablesFile string, commandLineVariables []string) ([]codersdk.VariableValue, error)
- func PrintDeprecatedOptions() serpent.MiddlewareFunc
- func PrintLogo(inv *serpent.Invocation, daemonTitle string)
- func ReadExternalAuthProvidersFromEnv(environ []string) ([]codersdk.ExternalAuthConfig, error)
- func ServeHandler(ctx context.Context, logger slog.Logger, handler http.Handler, ...) (closeFunc func())
- func SlimUnsupported(w io.Writer, cmd string)
- func WriteConfigMW(cfg *codersdk.DeploymentValues) serpent.MiddlewareFunc
- type Example
- type HTTPServers
- type ParameterResolver
- func (pr *ParameterResolver) Resolve(inv *serpent.Invocation, action WorkspaceCLIAction, ...) ([]codersdk.WorkspaceBuildParameter, error)
- func (pr *ParameterResolver) WithBuildOptions(params []codersdk.WorkspaceBuildParameter) *ParameterResolver
- func (pr *ParameterResolver) WithLastBuildParameters(params []codersdk.WorkspaceBuildParameter) *ParameterResolver
- func (pr *ParameterResolver) WithPromptBuildOptions(promptBuildOptions bool) *ParameterResolver
- func (pr *ParameterResolver) WithPromptRichParameters(promptRichParameters bool) *ParameterResolver
- func (pr *ParameterResolver) WithRichParameters(params []codersdk.WorkspaceBuildParameter) *ParameterResolver
- func (pr *ParameterResolver) WithRichParametersDefaults(params []codersdk.WorkspaceBuildParameter) *ParameterResolver
- func (pr *ParameterResolver) WithRichParametersFile(fileMap map[string]string) *ParameterResolver
- func (pr *ParameterResolver) WithSourceWorkspaceParameters(params []codersdk.WorkspaceBuildParameter) *ParameterResolver
- type PrettyErrorFormatter
- type RootCmd
- func (r *RootCmd) AGPL() []*serpent.Command
- func (r *RootCmd) Command(subcommands []*serpent.Command) (*serpent.Command, error)
- func (r *RootCmd) CoreSubcommands() []*serpent.Command
- func (r *RootCmd) HeaderTransport(ctx context.Context, serverURL *url.URL) (*codersdk.HeaderTransport, error)
- func (r *RootCmd) InitClient(client *codersdk.Client) serpent.MiddlewareFunc
- func (r *RootCmd) RunWithSubcommands(subcommands []*serpent.Command)
- func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.API, io.Closer, error)) *serpent.Command
- func (r *RootCmd) Verbosef(inv *serpent.Invocation, fmtStr string, args ...interface{})
- type WorkspaceCLIAction
Constants ¶
This section is empty.
Variables ¶
var (
Caret = pretty.Sprint(cliui.DefaultStyles.Prompt, "")
)
var InterruptSignals = []os.Signal{ os.Interrupt, }
InterruptSignals is the list of signals that are used for handling immediate shutdown behavior.
StopSignals is the list of signals that are used for handling shutdown behavior.
StopSignals is the list of signals that are used for handling graceful shutdown behavior.
Functions ¶
func ConfigureHTTPClient ¶
func ConfigureTraceProvider ¶
func ConnectToPostgres ¶ added in v2.2.0
func CurrentOrganization ¶
func CurrentOrganization(r *RootCmd, inv *serpent.Invocation, client *codersdk.Client) (codersdk.Organization, error)
CurrentOrganization returns the currently active organization for the authenticated user.
func DiscoverVarsFiles ¶ added in v2.7.0
*
- DiscoverVarsFiles function loads vars files in a predefined order:
- 1. terraform.tfvars
- 2. terraform.tfvars.json
- 3. *.auto.tfvars
- 4. *.auto.tfvars.json
func DumpHandler ¶
DumpHandler provides a custom SIGQUIT and SIGTRAP handler that dumps the stacktrace of all goroutines to stderr and a well-known file in the home directory. This is useful for debugging deadlock issues that may occur in production in workspaces, since the default Go runtime will only dump to stderr (which is often difficult/impossible to read in a workspace).
SIGQUITs will still cause the program to exit (similarly to the default Go runtime behavior).
A SIGQUIT handler will not be registered if GOTRACEBACK=crash.
On Windows this immediately returns.
func ExitError ¶ added in v2.5.0
ExitError returns an error that will cause the CLI to exit with the given exit code. If err is non-nil, it will be wrapped by the returned error.
func FormatExamples ¶ added in v2.12.0
FormatExamples formats the examples as width wrapped bulletpoint descriptions with the command underneath.
func IsLocalURL ¶
isLocalURL returns true if the hostname of the provided URL appears to resolve to a loopback address.
func IsLocalhost ¶
IsLocalhost returns true if the host points to the local machine. Intended to be called with `u.Hostname()`.
func ParseUserVariableValues ¶ added in v2.6.0
func PrintDeprecatedOptions ¶
func PrintDeprecatedOptions() serpent.MiddlewareFunc
printDeprecatedOptions loops through all command options, and prints a warning for usage of deprecated options.
func ReadExternalAuthProvidersFromEnv ¶ added in v2.2.1
func ReadExternalAuthProvidersFromEnv(environ []string) ([]codersdk.ExternalAuthConfig, error)
ReadExternalAuthProvidersFromEnv is provided for compatibility purposes with the viper CLI.
func ServeHandler ¶
func SlimUnsupported ¶ added in v2.1.5
func WriteConfigMW ¶
func WriteConfigMW(cfg *codersdk.DeploymentValues) serpent.MiddlewareFunc
writeConfigMW will prevent the main command from running if the write-config flag is set. Instead, it will marshal the command options to YAML and write them to stdout.
Types ¶
type Example ¶ added in v2.12.0
Example represents a standard example for command usage, to be used with FormatExamples.
type HTTPServers ¶
type HTTPServers struct { HTTPUrl *url.URL HTTPListener net.Listener // TLS TLSUrl *url.URL TLSListener net.Listener TLSConfig *tls.Config }
func ConfigureHTTPServers ¶
func ConfigureHTTPServers(logger slog.Logger, inv *serpent.Invocation, cfg *codersdk.DeploymentValues) (_ *HTTPServers, err error)
func (*HTTPServers) Close ¶
func (s *HTTPServers) Close()
type ParameterResolver ¶
type ParameterResolver struct {
// contains filtered or unexported fields
}
func (*ParameterResolver) Resolve ¶
func (pr *ParameterResolver) Resolve(inv *serpent.Invocation, action WorkspaceCLIAction, templateVersionParameters []codersdk.TemplateVersionParameter) ([]codersdk.WorkspaceBuildParameter, error)
func (*ParameterResolver) WithBuildOptions ¶
func (pr *ParameterResolver) WithBuildOptions(params []codersdk.WorkspaceBuildParameter) *ParameterResolver
func (*ParameterResolver) WithLastBuildParameters ¶
func (pr *ParameterResolver) WithLastBuildParameters(params []codersdk.WorkspaceBuildParameter) *ParameterResolver
func (*ParameterResolver) WithPromptBuildOptions ¶
func (pr *ParameterResolver) WithPromptBuildOptions(promptBuildOptions bool) *ParameterResolver
func (*ParameterResolver) WithPromptRichParameters ¶
func (pr *ParameterResolver) WithPromptRichParameters(promptRichParameters bool) *ParameterResolver
func (*ParameterResolver) WithRichParameters ¶
func (pr *ParameterResolver) WithRichParameters(params []codersdk.WorkspaceBuildParameter) *ParameterResolver
func (*ParameterResolver) WithRichParametersDefaults ¶ added in v2.11.0
func (pr *ParameterResolver) WithRichParametersDefaults(params []codersdk.WorkspaceBuildParameter) *ParameterResolver
func (*ParameterResolver) WithRichParametersFile ¶
func (pr *ParameterResolver) WithRichParametersFile(fileMap map[string]string) *ParameterResolver
func (*ParameterResolver) WithSourceWorkspaceParameters ¶ added in v2.4.0
func (pr *ParameterResolver) WithSourceWorkspaceParameters(params []codersdk.WorkspaceBuildParameter) *ParameterResolver
type PrettyErrorFormatter ¶ added in v2.10.0
type PrettyErrorFormatter struct {
// contains filtered or unexported fields
}
func NewPrettyErrorFormatter ¶ added in v2.10.0
func NewPrettyErrorFormatter(w io.Writer, verbose bool) *PrettyErrorFormatter
NewPrettyErrorFormatter creates a new PrettyErrorFormatter.
func (*PrettyErrorFormatter) Format ¶ added in v2.10.0
func (p *PrettyErrorFormatter) Format(err error)
Format formats the error to the writer in PrettyErrorFormatter. This error should be human readable.
type RootCmd ¶
type RootCmd struct {
// contains filtered or unexported fields
}
RootCmd contains parameters and helpers useful to all commands.
func (*RootCmd) CoreSubcommands ¶ added in v2.10.0
func (*RootCmd) HeaderTransport ¶ added in v2.5.0
func (r *RootCmd) HeaderTransport(ctx context.Context, serverURL *url.URL) (*codersdk.HeaderTransport, error)
HeaderTransport creates a new transport that executes `--header-command` if it is set to add headers for all outbound requests.
func (*RootCmd) InitClient ¶
func (r *RootCmd) InitClient(client *codersdk.Client) serpent.MiddlewareFunc
InitClient authenticates the client with files from disk and injects header middlewares for telemetry, authentication, and version checks.
func (*RootCmd) RunWithSubcommands ¶ added in v2.10.0
RunWithSubcommands runs the root command with the given subcommands. It is abstracted to enable the Enterprise code to add commands.
type WorkspaceCLIAction ¶
type WorkspaceCLIAction int
const ( WorkspaceCreate WorkspaceCLIAction = iota WorkspaceStart WorkspaceUpdate WorkspaceRestart )
Source Files
¶
- agent.go
- autoupdate.go
- configssh.go
- configssh_other.go
- create.go
- delete.go
- dotfiles.go
- errors.go
- exp.go
- exp_scaletest.go
- externalauth.go
- favorite.go
- gitaskpass.go
- gitssh.go
- help.go
- list.go
- login.go
- logout.go
- netcheck.go
- open.go
- organization.go
- organizationmanage.go
- organizationroles.go
- parameter.go
- parameterresolver.go
- ping.go
- portforward.go
- publickey.go
- remoteforward.go
- rename.go
- resetpassword.go
- restart.go
- root.go
- schedule.go
- server.go
- server_createadminuser.go
- show.go
- signal_unix.go
- speedtest.go
- ssh.go
- ssh_other.go
- start.go
- stat.go
- state.go
- stop.go
- support.go
- templatecreate.go
- templatedelete.go
- templateedit.go
- templateinit.go
- templatelist.go
- templatepull.go
- templatepush.go
- templates.go
- templatevariables.go
- templateversionarchive.go
- templateversions.go
- tokens.go
- update.go
- usercreate.go
- userdelete.go
- userlist.go
- users.go
- userstatus.go
- util.go
- version.go
- vscodessh.go