Documentation
¶
Index ¶
- Constants
- 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, ...) (*sql.DB, 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 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 ClaudeConfig
- type ClaudeConfigMCP
- type Example
- type HTTPServers
- type OrganizationContext
- type ParameterResolver
- func (pr *ParameterResolver) Resolve(inv *serpent.Invocation, action WorkspaceCLIAction, ...) ([]codersdk.WorkspaceBuildParameter, error)
- func (pr *ParameterResolver) WithEphemeralParameters(params []codersdk.WorkspaceBuildParameter) *ParameterResolver
- func (pr *ParameterResolver) WithLastBuildParameters(params []codersdk.WorkspaceBuildParameter) *ParameterResolver
- func (pr *ParameterResolver) WithPromptEphemeralParameters(promptEphemeralParameters 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) Provisioners() *serpent.Command
- 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 SpeedtestResult
- type SpeedtestResultInterval
- type WorkspaceCLIAction
Constants ¶
const ( // Client ID for https://github.com/apps/coder GithubOAuth2DefaultProviderClientID = "Iv1.6a2b4b4aec4f4fe7" GithubOAuth2DefaultProviderAllowEveryone = true GithubOAuth2DefaultProviderDeviceFlow = true )
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 ConnectToPostgres(ctx context.Context, logger slog.Logger, driver string, dbURL string, migrate func(db *sql.DB) error) (*sql.DB, error)
ConnectToPostgres takes in the migration command to run on the database once it connects. To avoid running migrations, pass in `nil` or a no-op function. Regardless of the passed in migration function, if the database is not fully migrated, an error will be returned. This can happen if the database is on a future or past migration version.
If no error is returned, the database is fully migrated and up to date.
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 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 ClaudeConfig ¶ added in v2.21.0
type ClaudeConfigMCP ¶ added in v2.21.0
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 OrganizationContext ¶ added in v2.14.0
type OrganizationContext struct { // FlagSelect is the value passed in via the --org flag FlagSelect string }
func NewOrganizationContext ¶ added in v2.14.0
func NewOrganizationContext() *OrganizationContext
func (*OrganizationContext) AttachOptions ¶ added in v2.14.0
func (o *OrganizationContext) AttachOptions(cmd *serpent.Command)
func (*OrganizationContext) Selected ¶ added in v2.14.0
func (o *OrganizationContext) Selected(inv *serpent.Invocation, client *codersdk.Client) (codersdk.Organization, error)
func (*OrganizationContext) ValueSource ¶ added in v2.14.0
func (o *OrganizationContext) ValueSource(inv *serpent.Invocation) (string, serpent.ValueSource)
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) WithEphemeralParameters ¶ added in v2.17.0
func (pr *ParameterResolver) WithEphemeralParameters(params []codersdk.WorkspaceBuildParameter) *ParameterResolver
func (*ParameterResolver) WithLastBuildParameters ¶
func (pr *ParameterResolver) WithLastBuildParameters(params []codersdk.WorkspaceBuildParameter) *ParameterResolver
func (*ParameterResolver) WithPromptEphemeralParameters ¶ added in v2.17.0
func (pr *ParameterResolver) WithPromptEphemeralParameters(promptEphemeralParameters 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) Provisioners ¶ added in v2.19.0
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 SpeedtestResult ¶ added in v2.13.0
type SpeedtestResult struct { Overall SpeedtestResultInterval `json:"overall"` Intervals []SpeedtestResultInterval `json:"intervals"` }
type SpeedtestResultInterval ¶ added in v2.13.0
type WorkspaceCLIAction ¶
type WorkspaceCLIAction int
const ( WorkspaceCreate WorkspaceCLIAction = iota WorkspaceStart WorkspaceUpdate WorkspaceRestart )
Source Files
¶
- agent.go
- autoupdate.go
- completion.go
- configssh.go
- configssh_other.go
- create.go
- delete.go
- dotfiles.go
- dotfiles_other.go
- exp.go
- exp_errors.go
- exp_mcp.go
- exp_prompts.go
- exp_rpty.go
- exp_scaletest.go
- externalauth.go
- favorite.go
- gitaskpass.go
- gitssh.go
- help.go
- list.go
- login.go
- logout.go
- netcheck.go
- notifications.go
- open.go
- organization.go
- organizationmanage.go
- organizationmembers.go
- organizationroles.go
- organizationsettings.go
- parameter.go
- parameterresolver.go
- ping.go
- portforward.go
- provisionerjobs.go
- provisioners.go
- publickey.go
- remoteforward.go
- rename.go
- resetpassword.go
- restart.go
- root.go
- schedule.go
- server.go
- server_createadminuser.go
- server_regenerate_vapid_keypair.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
- templateversionarchive.go
- templateversions.go
- tokens.go
- update.go
- usercreate.go
- userdelete.go
- userlist.go
- users.go
- userstatus.go
- util.go
- version.go
- vpndaemon.go
- vpndaemon_other.go
- vscodessh.go
- whoami.go