Documentation
¶
Index ¶
- Variables
- func FilterCommandsByAllowlist(commands []console.Command, allowlist []string) []console.Command
- type Application
- type CliContext
- func (r *CliContext) Argument(index int) string
- func (r *CliContext) ArgumentFloat32(key string) float32
- func (r *CliContext) ArgumentFloat32Slice(key string) []float32
- func (r *CliContext) ArgumentFloat64(key string) float64
- func (r *CliContext) ArgumentFloat64Slice(key string) []float64
- func (r *CliContext) ArgumentInt(key string) int
- func (r *CliContext) ArgumentInt8(key string) int8
- func (r *CliContext) ArgumentInt8Slice(key string) []int8
- func (r *CliContext) ArgumentInt16(key string) int16
- func (r *CliContext) ArgumentInt16Slice(key string) []int16
- func (r *CliContext) ArgumentInt32(key string) int32
- func (r *CliContext) ArgumentInt32Slice(key string) []int32
- func (r *CliContext) ArgumentInt64(key string) int64
- func (r *CliContext) ArgumentInt64Slice(key string) []int64
- func (r *CliContext) ArgumentIntSlice(key string) []int
- func (r *CliContext) ArgumentString(key string) string
- func (r *CliContext) ArgumentStringSlice(key string) []string
- func (r *CliContext) ArgumentTimestamp(key string) time.Time
- func (r *CliContext) ArgumentTimestampSlice(key string) []time.Time
- func (r *CliContext) ArgumentUint(key string) uint
- func (r *CliContext) ArgumentUint8(key string) uint8
- func (r *CliContext) ArgumentUint8Slice(key string) []uint8
- func (r *CliContext) ArgumentUint16(key string) uint16
- func (r *CliContext) ArgumentUint16Slice(key string) []uint16
- func (r *CliContext) ArgumentUint32(key string) uint32
- func (r *CliContext) ArgumentUint32Slice(key string) []uint32
- func (r *CliContext) ArgumentUint64(key string) uint64
- func (r *CliContext) ArgumentUint64Slice(key string) []uint64
- func (r *CliContext) ArgumentUintSlice(key string) []uint
- func (r *CliContext) Arguments() []string
- func (r *CliContext) Ask(question string, option ...console.AskOption) (string, error)
- func (r *CliContext) Black(message string)
- func (r *CliContext) Blackln(message string)
- func (r *CliContext) Choice(question string, choices []console.Choice, option ...console.ChoiceOption) (string, error)
- func (r *CliContext) Comment(message string)
- func (r *CliContext) Confirm(question string, option ...console.ConfirmOption) bool
- func (r *CliContext) CreateProgressBar(total int) console.Progress
- func (r *CliContext) Deadline() (deadline time.Time, ok bool)
- func (r *CliContext) Divider(filler ...string)
- func (r *CliContext) Done() <-chan struct{}
- func (r *CliContext) Err() error
- func (r *CliContext) Error(message string)
- func (r *CliContext) Green(message string)
- func (r *CliContext) Greenln(message string)
- func (r *CliContext) Info(message string)
- func (r *CliContext) Instance() *cli.Command
- func (r *CliContext) Line(message string)
- func (r *CliContext) MultiSelect(question string, choices []console.Choice, option ...console.MultiSelectOption) ([]string, error)
- func (r *CliContext) NewLine(times ...int)
- func (r *CliContext) Option(key string) string
- func (r *CliContext) OptionBool(key string) bool
- func (r *CliContext) OptionFloat64(key string) float64
- func (r *CliContext) OptionFloat64Slice(key string) []float64
- func (r *CliContext) OptionInt(key string) int
- func (r *CliContext) OptionInt64(key string) int64
- func (r *CliContext) OptionInt64Slice(key string) []int64
- func (r *CliContext) OptionIntSlice(key string) []int
- func (r *CliContext) OptionSlice(key string) []string
- func (r *CliContext) Red(message string)
- func (r *CliContext) Redln(message string)
- func (r *CliContext) Secret(question string, option ...console.SecretOption) (string, error)
- func (r *CliContext) Spinner(message string, option console.SpinnerOption) error
- func (r *CliContext) Success(message string)
- func (r *CliContext) Table(headers []string, rows [][]string, option ...console.TableOption)
- func (r *CliContext) TwoColumnDetail(first, second string, filler ...rune)
- func (r *CliContext) Value(key any) any
- func (r *CliContext) Warning(message string)
- func (r *CliContext) WithProgressBar(items []any, callback func(any) error) ([]any, error)
- func (r *CliContext) Yellow(message string)
- func (r *CliContext) Yellowln(message string)
- type ProgressBar
- type ServiceProvider
Constants ¶
This section is empty.
Variables ¶
View Source
var ( BrandColor = lipgloss.CompleteColor{TrueColor: "#3D8C8D", ANSI256: "30", ANSI: "6"} MutedColor = lipgloss.CompleteColor{TrueColor: "#4a4a4a", ANSI256: "240", ANSI: "8"} WhiteColor = lipgloss.CompleteColor{TrueColor: "#ffffff", ANSI256: "255", ANSI: "15"} DefaultProgressBarStyle = pterm.NewStyle(pterm.FgLightGreen) DefaultProgressTitleStyle = pterm.NewStyle(pterm.FgWhite) DefaultTableHeaderColor = BrandColor DefaultTableBorderColor = MutedColor DefaultTableHeaderStyle = lipgloss.NewStyle().Foreground(DefaultTableHeaderColor).Bold(true).Padding(0, 1) DefaultTableCellStyle = lipgloss.NewStyle().Padding(0, 1) DefaultSpinnerStyle = lipgloss.NewStyle().Foreground(BrandColor) DefaultSpinnerTitleStyle = lipgloss.NewStyle().Foreground(BrandColor) DefaultTableStyleFunc = func(row, col int) lipgloss.Style { if row == table.HeaderRow { return DefaultTableHeaderStyle } return DefaultTableCellStyle } DefaultTableOption = console.TableOption{ Border: lipgloss.RoundedBorder(), BorderStyle: lipgloss.NewStyle().Foreground(DefaultTableBorderColor), StyleFunc: DefaultTableStyleFunc, BorderTop: new(true), BorderBottom: new(true), BorderLeft: new(true), BorderRight: new(true), BorderHeader: new(true), BorderColumn: new(true), BorderRow: new(false), } GlobalHuhTheme = func() *huh.Theme { t := huh.ThemeCharm() t.Focused.Title = t.Focused.Title.Foreground(BrandColor) t.Focused.TextInput.Prompt = t.Focused.TextInput.Prompt.Foreground(BrandColor) t.Focused.TextInput.Cursor = t.Focused.TextInput.Cursor.Foreground(BrandColor) t.Focused.Base = t.Focused.Base.BorderForeground(BrandColor) t.Focused.SelectedOption = t.Focused.SelectedOption.Foreground(BrandColor) t.Focused.MultiSelectSelector = t.Focused.MultiSelectSelector.Foreground(BrandColor) t.Focused.FocusedButton = t.Focused.FocusedButton. Background(BrandColor). Foreground(WhiteColor) return t }() )
Functions ¶
func FilterCommandsByAllowlist ¶
FilterCommandsByAllowlist returns the subset of commands whose Signature() matches at least one entry in allowlist.
Matching is signature-only (category never consulted):
- Entries without '*' are exact-matched against command.Signature().
- Entries containing '*' use glob matching via path.Match against command.Signature() (only '*' triggers the glob path; '?' is matched literally as an exact match).
Special cases:
- allowlist == nil → every command is kept (no filter applied).
- allowlist resolves to no usable entries → every command is dropped.
Types ¶
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
func NewApplication ¶
func NewApplication(name, usage, usageText, version string, useArtisan bool) *Application
NewApplication Create a new Artisan application. Will add artisan flag to the command if useArtisan is true.
func (*Application) Call ¶
func (r *Application) Call(command string) error
Call Run an Artisan console command by name.
func (*Application) CallAndExit ¶
func (r *Application) CallAndExit(command string)
CallAndExit Run an Artisan console command by name and exit.
func (*Application) Register ¶
func (r *Application) Register(commands []console.Command)
Register commands to the application.
func (*Application) Run ¶
func (r *Application) Run(args []string, exitIfArtisan bool) error
Run a command. Args come from os.Args.
func (*Application) SetCommands ¶
func (r *Application) SetCommands(commands []console.Command)
SetCommands Set the commands for the application.
type CliContext ¶
type CliContext struct {
// contains filtered or unexported fields
}
func NewCliContext ¶
func (*CliContext) Argument ¶
func (r *CliContext) Argument(index int) string
func (*CliContext) ArgumentFloat32 ¶
func (r *CliContext) ArgumentFloat32(key string) float32
func (*CliContext) ArgumentFloat32Slice ¶
func (r *CliContext) ArgumentFloat32Slice(key string) []float32
func (*CliContext) ArgumentFloat64 ¶
func (r *CliContext) ArgumentFloat64(key string) float64
func (*CliContext) ArgumentFloat64Slice ¶
func (r *CliContext) ArgumentFloat64Slice(key string) []float64
func (*CliContext) ArgumentInt ¶
func (r *CliContext) ArgumentInt(key string) int
func (*CliContext) ArgumentInt8 ¶
func (r *CliContext) ArgumentInt8(key string) int8
func (*CliContext) ArgumentInt8Slice ¶
func (r *CliContext) ArgumentInt8Slice(key string) []int8
func (*CliContext) ArgumentInt16 ¶
func (r *CliContext) ArgumentInt16(key string) int16
func (*CliContext) ArgumentInt16Slice ¶
func (r *CliContext) ArgumentInt16Slice(key string) []int16
func (*CliContext) ArgumentInt32 ¶
func (r *CliContext) ArgumentInt32(key string) int32
func (*CliContext) ArgumentInt32Slice ¶
func (r *CliContext) ArgumentInt32Slice(key string) []int32
func (*CliContext) ArgumentInt64 ¶
func (r *CliContext) ArgumentInt64(key string) int64
func (*CliContext) ArgumentInt64Slice ¶
func (r *CliContext) ArgumentInt64Slice(key string) []int64
func (*CliContext) ArgumentIntSlice ¶
func (r *CliContext) ArgumentIntSlice(key string) []int
func (*CliContext) ArgumentString ¶
func (r *CliContext) ArgumentString(key string) string
func (*CliContext) ArgumentStringSlice ¶
func (r *CliContext) ArgumentStringSlice(key string) []string
func (*CliContext) ArgumentTimestamp ¶
func (r *CliContext) ArgumentTimestamp(key string) time.Time
func (*CliContext) ArgumentTimestampSlice ¶
func (r *CliContext) ArgumentTimestampSlice(key string) []time.Time
func (*CliContext) ArgumentUint ¶
func (r *CliContext) ArgumentUint(key string) uint
func (*CliContext) ArgumentUint8 ¶
func (r *CliContext) ArgumentUint8(key string) uint8
func (*CliContext) ArgumentUint8Slice ¶
func (r *CliContext) ArgumentUint8Slice(key string) []uint8
func (*CliContext) ArgumentUint16 ¶
func (r *CliContext) ArgumentUint16(key string) uint16
func (*CliContext) ArgumentUint16Slice ¶
func (r *CliContext) ArgumentUint16Slice(key string) []uint16
func (*CliContext) ArgumentUint32 ¶
func (r *CliContext) ArgumentUint32(key string) uint32
func (*CliContext) ArgumentUint32Slice ¶
func (r *CliContext) ArgumentUint32Slice(key string) []uint32
func (*CliContext) ArgumentUint64 ¶
func (r *CliContext) ArgumentUint64(key string) uint64
func (*CliContext) ArgumentUint64Slice ¶
func (r *CliContext) ArgumentUint64Slice(key string) []uint64
func (*CliContext) ArgumentUintSlice ¶
func (r *CliContext) ArgumentUintSlice(key string) []uint
func (*CliContext) Arguments ¶
func (r *CliContext) Arguments() []string
func (*CliContext) Black ¶
func (r *CliContext) Black(message string)
func (*CliContext) Blackln ¶
func (r *CliContext) Blackln(message string)
func (*CliContext) Choice ¶
func (r *CliContext) Choice(question string, choices []console.Choice, option ...console.ChoiceOption) (string, error)
func (*CliContext) Comment ¶
func (r *CliContext) Comment(message string)
func (*CliContext) Confirm ¶
func (r *CliContext) Confirm(question string, option ...console.ConfirmOption) bool
func (*CliContext) CreateProgressBar ¶
func (r *CliContext) CreateProgressBar(total int) console.Progress
func (*CliContext) Divider ¶
func (r *CliContext) Divider(filler ...string)
func (*CliContext) Done ¶
func (r *CliContext) Done() <-chan struct{}
func (*CliContext) Err ¶
func (r *CliContext) Err() error
func (*CliContext) Error ¶
func (r *CliContext) Error(message string)
func (*CliContext) Green ¶
func (r *CliContext) Green(message string)
func (*CliContext) Greenln ¶
func (r *CliContext) Greenln(message string)
func (*CliContext) Info ¶
func (r *CliContext) Info(message string)
func (*CliContext) Instance ¶
func (r *CliContext) Instance() *cli.Command
func (*CliContext) Line ¶
func (r *CliContext) Line(message string)
func (*CliContext) MultiSelect ¶
func (r *CliContext) MultiSelect(question string, choices []console.Choice, option ...console.MultiSelectOption) ([]string, error)
func (*CliContext) NewLine ¶
func (r *CliContext) NewLine(times ...int)
func (*CliContext) Option ¶
func (r *CliContext) Option(key string) string
func (*CliContext) OptionBool ¶
func (r *CliContext) OptionBool(key string) bool
func (*CliContext) OptionFloat64 ¶
func (r *CliContext) OptionFloat64(key string) float64
func (*CliContext) OptionFloat64Slice ¶
func (r *CliContext) OptionFloat64Slice(key string) []float64
func (*CliContext) OptionInt ¶
func (r *CliContext) OptionInt(key string) int
func (*CliContext) OptionInt64 ¶
func (r *CliContext) OptionInt64(key string) int64
func (*CliContext) OptionInt64Slice ¶
func (r *CliContext) OptionInt64Slice(key string) []int64
func (*CliContext) OptionIntSlice ¶
func (r *CliContext) OptionIntSlice(key string) []int
func (*CliContext) OptionSlice ¶
func (r *CliContext) OptionSlice(key string) []string
func (*CliContext) Red ¶
func (r *CliContext) Red(message string)
func (*CliContext) Redln ¶
func (r *CliContext) Redln(message string)
func (*CliContext) Secret ¶
func (r *CliContext) Secret(question string, option ...console.SecretOption) (string, error)
func (*CliContext) Spinner ¶
func (r *CliContext) Spinner(message string, option console.SpinnerOption) error
func (*CliContext) Success ¶
func (r *CliContext) Success(message string)
func (*CliContext) Table ¶
func (r *CliContext) Table(headers []string, rows [][]string, option ...console.TableOption)
func (*CliContext) TwoColumnDetail ¶
func (r *CliContext) TwoColumnDetail(first, second string, filler ...rune)
func (*CliContext) Value ¶
func (r *CliContext) Value(key any) any
func (*CliContext) Warning ¶
func (r *CliContext) Warning(message string)
func (*CliContext) WithProgressBar ¶
func (*CliContext) Yellow ¶
func (r *CliContext) Yellow(message string)
func (*CliContext) Yellowln ¶
func (r *CliContext) Yellowln(message string)
type ProgressBar ¶
type ProgressBar struct {
// contains filtered or unexported fields
}
func NewProgressBar ¶
func NewProgressBar(total int) *ProgressBar
func (*ProgressBar) Advance ¶
func (r *ProgressBar) Advance(step ...int)
func (*ProgressBar) Finish ¶
func (r *ProgressBar) Finish() error
func (*ProgressBar) SetTitle ¶
func (r *ProgressBar) SetTitle(message string)
func (*ProgressBar) ShowElapsedTime ¶
func (r *ProgressBar) ShowElapsedTime(b ...bool) console.Progress
func (*ProgressBar) Start ¶
func (r *ProgressBar) Start() error
type ServiceProvider ¶
type ServiceProvider struct {
}
func (*ServiceProvider) Boot ¶
func (r *ServiceProvider) Boot(app foundation.Application)
func (*ServiceProvider) Register ¶
func (r *ServiceProvider) Register(app foundation.Application)
func (*ServiceProvider) Relationship ¶
func (r *ServiceProvider) Relationship() binding.Relationship
Source Files
¶
Click to show internal directories.
Click to hide internal directories.