Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Artisan ¶
type Artisan interface {
// Register commands.
Register(commands []Command)
// Call run an Artisan console command by name.
Call(command string) error
// CallAndExit run an Artisan console command by name and exit.
CallAndExit(command string)
// Run a command. args include: ["./main", "artisan", "command"]
Run(args []string, exitIfArtisan bool) error
}
type AskOption ¶ added in v1.14.0
type AskOption struct {
// Validate the input validation function.
Validate func(string) error
// Default the default value for the input.
Default string
// Description the input description.
Description string
// Placeholder the input placeholder.
Placeholder string
// Prompt the prompt message.(use for single line input)
Prompt string
// Lines the number of lines for the input.(use for multiple lines text)
Lines int
// Limit the character limit for the input.
Limit int
// Multiple determines if input is single line or multiple lines text
Multiple bool
}
type ChoiceOption ¶ added in v1.14.0
type ConfirmOption ¶ added in v1.14.0
type Context ¶ added in v1.0.0
type Context interface {
// Ask prompts the user for input.
Ask(question string, option ...AskOption) (string, error)
// CreateProgressBar creates a new progress bar instance.
CreateProgressBar(total int) Progress
// Choice prompts the user to select from a list of options.
Choice(question string, options []Choice, option ...ChoiceOption) (string, error)
// Comment writes a comment message to the console.
Comment(message string)
// Confirm prompts the user for a confirmation.
Confirm(question string, option ...ConfirmOption) bool
// Argument get the value of a command argument.
Argument(index int) string
// Arguments get all the arguments passed to command.
Arguments() []string
// Info writes an information message to the console.
Info(message string)
// Instance gets the underlying cli.Command instance.
Instance() *cli.Command
// Error writes an error message to the console.
Error(message string)
// Line writes a string to the console.
Line(message string)
// MultiSelect prompts the user to select multiple options from a list of options.
MultiSelect(question string, options []Choice, option ...MultiSelectOption) ([]string, error)
// NewLine writes a newline character to the console.
NewLine(times ...int)
// Option gets the value of a command option.
Option(key string) string
// OptionSlice looks up the value of a local StringSliceFlag, returns nil if not found
OptionSlice(key string) []string
// OptionBool looks up the value of a local BoolFlag, returns false if not found
OptionBool(key string) bool
// OptionFloat64 looks up the value of a local Float64Flag, returns zero if not found
OptionFloat64(key string) float64
// OptionFloat64Slice looks up the value of a local Float64SliceFlag, returns nil if not found
OptionFloat64Slice(key string) []float64
// OptionInt looks up the value of a local IntFlag, returns zero if not found
OptionInt(key string) int
// OptionIntSlice looks up the value of a local IntSliceFlag, returns nil if not found
OptionIntSlice(key string) []int
// OptionInt64 looks up the value of a local Int64Flag, returns zero if not found
OptionInt64(key string) int64
// OptionInt64Slice looks up the value of a local Int64SliceFlag, returns nil if not found
OptionInt64Slice(key string) []int64
// Secret prompts the user for a password.
Secret(question string, option ...SecretOption) (string, error)
// Spinner creates a new spinner instance.
Spinner(message string, option SpinnerOption) error
// Success writes a success message to the console.
Success(message string)
// Warning writes a warning message to the console.
Warning(message string)
// WithProgressBar executes a callback with a progress bar.
WithProgressBar(items []any, callback func(any) error) ([]any, error)
// TwoColumnDetail writes a two column detail to the console.
TwoColumnDetail(first, second string, filler ...rune)
}
type MultiSelectOption ¶ added in v1.14.0
type MultiSelectOption struct {
// Validate the input validation function.
Validate func([]string) error
// Description the input description.
Description string
// Default the default value for the input.
Default []string
// Limit the number of choices that can be selected.
Limit int
// Filterable determines if the choices can be filtered.
Filterable bool
}
type Progress ¶ added in v1.14.0
type Progress interface {
// Advance advances the progress bar by a given step.
Advance(step ...int)
// Finish completes the progress bar.
Finish() error
// ShowElapsedTime sets if the elapsed time should be displayed in the progress bar.
ShowElapsedTime(b ...bool) Progress
// ShowTitle sets the title of the progress bar.
ShowTitle(b ...bool) Progress
// SetTitle sets the message of the progress bar.
SetTitle(message string)
// Start starts the progress bar.
Start() error
}
type SecretOption ¶ added in v1.14.0
type SecretOption struct {
// Validate the input validation function.
Validate func(string) error
// Default the default value for the input.
Default string
// Description the input description.
Description string
// Placeholder the input placeholder.
Placeholder string
// Limit the character limit for the input.
Limit int
}
type SpinnerOption ¶ added in v1.14.0
Click to show internal directories.
Click to hide internal directories.