Movatterモバイル変換


[0]ホーム

URL:


Alert GO-2024-3228: Coder vulnerable to post-auth URL redirection to untrusted site ('Open Redirect') in github.com/coder/coder
Notice  The highest tagged major version isv2.

cliui

package
v0.27.3Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2023 License:AGPL-3.0Imports:32Imported by:0

Details

Repository

github.com/coder/coder

Links

Documentation

Index

Constants

View Source
const (ConfirmYes = "yes"ConfirmNo  = "no")

Variables

View Source
var Canceled =xerrors.New("canceled")

Functions

funcAgent

func Agent(ctxcontext.Context, writerio.Writer, agentIDuuid.UUID, optsAgentOptions)error

Agent displays a spinning indicator that waits for a workspace agent to connect.

funcDisplayTableadded inv0.8.6

func DisplayTable(outany, sortstring, filterColumns []string) (string,error)

DisplayTable renders a table as a string. The input argument must be a sliceof structs. At least one field in the struct must have a `table:""` tagcontaining the name of the column in the outputted table.

If `sort` is not specified, the field with the `table:"$NAME,default_sort"`tag will be used to sort. An error will be returned if no field has this tag.

Nested structs are processed if the field has the `table:"$NAME,recursive"`tag and their fields will be named as `$PARENT_NAME $NAME`. If the tag ismalformed or a field is marked as recursive but does not contain a struct ora pointer to a struct, this function will return an error (even with an emptyinput slice).

If sort is empty, the input order will be used. If filterColumns is empty ornil, all available columns are included.

funcErroradded inv0.21.0

func Error(wtrio.Writer, headerstring, lines ...string)

Error writes a log to the writer provided.

funcErrorfadded inv0.21.0

func Errorf(wtrio.Writer, fmtStrstring, args ...interface{})

Errorf writes a formatted log to the writer provided.

funcGitAuthadded inv0.18.0

func GitAuth(ctxcontext.Context, writerio.Writer, optsGitAuthOptions)error

funcInfoadded inv0.21.0

func Info(wtrio.Writer, headerstring, lines ...string)

Info writes a log to the writer provided.

funcInfofadded inv0.21.0

func Infof(wtrio.Writer, fmtStrstring, args ...interface{})

Infof writes a formatted log to the writer provided.

funcMultiSelectadded inv0.20.0

func MultiSelect(inv *clibase.Invocation, items []string) ([]string,error)

funcPrompt

func Prompt(inv *clibase.Invocation, optsPromptOptions) (string,error)

Prompt asks the user for input.

funcProvisionerJob

func ProvisionerJob(ctxcontext.Context, writerio.Writer, optsProvisionerJobOptions)error

ProvisionerJob renders a provisioner job with interactive cancellation.

funcRichParameteradded inv0.15.2

func RichParameter(inv *clibase.Invocation, templateVersionParametercodersdk.TemplateVersionParameter) (string,error)

funcRichSelectadded inv0.15.3

RichSelect displays a list of user options including name and description.

funcSelect

func Select(inv *clibase.Invocation, optsSelectOptions) (string,error)

Select displays a list of user options.

funcSkipPromptOptionadded inv0.21.0

func SkipPromptOption()clibase.Option

SkipPromptOption adds a "--yes/-y" flag to the cmd that can be used to skipprompts.

funcTableadded inv0.5.6

func Table()table.Writer

Table creates a new table with standardized styles.

funcValidateNotEmpty

func ValidateNotEmpty(sstring)error

ValidateNotEmpty is a helper function to disallow empty inputs!

funcWarn

func Warn(wtrio.Writer, headerstring, lines ...string)

Warn writes a log to the writer provided.

funcWarnfadded inv0.21.0

func Warnf(wtrio.Writer, fmtStrstring, args ...interface{})

Warn writes a formatted log to the writer provided.

funcWorkspaceBuild

func WorkspaceBuild(ctxcontext.Context, writerio.Writer, client *codersdk.Client, builduuid.UUID)error

funcWorkspaceResourcesadded inv0.4.1

func WorkspaceResources(writerio.Writer, resources []codersdk.WorkspaceResource, optionsWorkspaceResourcesOptions)error

WorkspaceResources displays the connection status and tree-view of provided resources.┌────────────────────────────────────────────────────────────────────────────┐│ RESOURCE STATUS ACCESS │├────────────────────────────────────────────────────────────────────────────┤│ google_compute_disk.root │├────────────────────────────────────────────────────────────────────────────┤│ google_compute_instance.dev ││ └─ dev (linux, amd64) ⦾ connecting [10s] coder ssh dev.dev │├────────────────────────────────────────────────────────────────────────────┤│ kubernetes_pod.dev ││ ├─ go (linux, amd64) ⦿ connected coder ssh dev.go ││ └─ postgres (linux, amd64) ⦾ disconnected [4s] coder ssh dev.postgres │└────────────────────────────────────────────────────────────────────────────┘

Types

typeAgentOptions

type AgentOptions struct {FetchIntervaltime.DurationFetch         func(ctxcontext.Context, agentIDuuid.UUID) (codersdk.WorkspaceAgent,error)FetchLogs     func(ctxcontext.Context, agentIDuuid.UUID, afterint64, followbool) (<-chan []codersdk.WorkspaceAgentStartupLog,io.Closer,error)Waitbool// If true, wait for the agent to be ready (startup script).}

typeDataChangeFormatadded inv0.23.0

type DataChangeFormat struct {// contains filtered or unexported fields}

DataChangeFormat allows manipulating the data passed to an output format.This is because sometimes the data needs to be manipulated before it can bepassed to the output format.For example, you may want to pass something different to the text formatterthan what you pass to the json formatter.

funcChangeFormatterDataadded inv0.23.0

func ChangeFormatterData(formatOutputFormat, change func(dataany) (any,error)) *DataChangeFormat

ChangeFormatterData allows manipulating the data passed to an outputformat.

func (*DataChangeFormat)AttachOptionsadded inv0.23.0

func (d *DataChangeFormat) AttachOptions(opts *clibase.OptionSet)

func (*DataChangeFormat)Formatadded inv0.23.0

func (d *DataChangeFormat) Format(ctxcontext.Context, dataany) (string,error)

func (*DataChangeFormat)IDadded inv0.23.0

func (d *DataChangeFormat) ID()string

typeGitAuthOptionsadded inv0.18.0

type GitAuthOptions struct {Fetch         func(context.Context) ([]codersdk.TemplateVersionGitAuth,error)FetchIntervaltime.Duration}

typeOutputFormatadded inv0.17.1

type OutputFormat interface {ID()stringAttachOptions(opts *clibase.OptionSet)Format(ctxcontext.Context, dataany) (string,error)}

funcJSONFormatadded inv0.17.1

func JSONFormat()OutputFormat

JSONFormat creates a JSON formatter.

funcTableFormatadded inv0.17.1

func TableFormat(outany, defaultColumns []string)OutputFormat

TableFormat creates a table formatter for the given output type. The outputtype should be specified as an empty slice of the desired type.

E.g.: TableFormat([]MyType{}, []string{"foo", "bar"})

defaultColumns is optional and specifies the default columns to display. Ifnot specified, all columns are displayed by default.

funcTextFormatadded inv0.22.0

func TextFormat()OutputFormat

TextFormat is a formatter that just outputs unstructured text.It uses fmt.Sprintf under the hood.

typeOutputFormatteradded inv0.17.1

type OutputFormatter struct {// contains filtered or unexported fields}

funcNewOutputFormatteradded inv0.17.1

func NewOutputFormatter(formats ...OutputFormat) *OutputFormatter

NewOutputFormatter creates a new OutputFormatter with the given formats. Thefirst format is the default format. At least two formats must be provided.

func (*OutputFormatter)AttachOptionsadded inv0.21.0

func (f *OutputFormatter) AttachOptions(opts *clibase.OptionSet)

AttachOptions attaches the --output flag to the given command, and anyadditional flags required by the output formatters.

func (*OutputFormatter)Formatadded inv0.17.1

func (f *OutputFormatter) Format(ctxcontext.Context, dataany) (string,error)

Format formats the given data using the format specified by the --outputflag. If the flag is not set, the default format is used.

typePromptOptions

type PromptOptions struct {TextstringDefaultstringSecretboolIsConfirmboolValidate  func(string)error}

PromptOptions supply a set of options to the prompt.

typeProvisionerJobErroradded inv0.19.0

type ProvisionerJobError struct {MessagestringCodecodersdk.JobErrorCode}

func (*ProvisionerJobError)Erroradded inv0.19.0

func (err *ProvisionerJobError) Error()string

typeProvisionerJobOptions

type ProvisionerJobOptions struct {Fetch  func() (codersdk.ProvisionerJob,error)Cancel func()errorLogs   func() (<-chancodersdk.ProvisionerJobLog,io.Closer,error)FetchIntervaltime.Duration// Verbose determines whether debug and trace logs will be shown.Verbosebool// Silent determines whether log output will be shown unless there is an// error.Silentbool}

typeRichSelectOptionsadded inv0.15.3

type RichSelectOptions struct {Options    []codersdk.TemplateVersionParameterOptionDefaultstringSizeintHideSearchbool}

typeSelectOptions

type SelectOptions struct {Options []string// Default will be highlighted first if it's a valid option.DefaultstringSizeintHideSearchbool}

typeStyles

type Styles struct {Bold,Checkmark,Code,Crossmark,DateTimeStamp,Error,Field,Keyword,Paragraph,Placeholder,Prompt,FocusedPrompt,Fuchsia,Logo,Warn,Wraplipgloss.Style}
var DefaultStylesStyles

DefaultStyles compose visual elements of the UI.

typeWorkspaceResourcesOptionsadded inv0.4.1

type WorkspaceResourcesOptions struct {WorkspaceNamestringHideAgentStateboolHideAccessboolTitlestringServerVersionstring}

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp