Documentation
¶
Index ¶
- Constants
- Variables
- func AppRoot() (appRoot, relPath string)
- func AppSlug() string
- func AppSlugOrLocalID() string
- func AutoCompleteAppSlug(cmd *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective)
- func AutoCompleteEnvSlug(cmd *cobra.Command, args []string, toComplete string) (rtn []string, dir cobra.ShellCompDirective)
- func AutoCompleteFromStaticList(args ...string) ...
- func ClearTerminalExceptFirstNLines(n int)
- func ConnectDaemon(ctx context.Context) daemonpb.DaemonClient
- func DisplayError(out *os.File, err []byte)
- func Fatal(args ...any)
- func Fatalf(format string, args ...any)
- func FindAppRootFromDir(dir string) (appRoot, relPath string, err error)
- func FormatStack(val any, buf *bytes.Buffer) error
- func IsDaemonRunning(ctx context.Context) bool
- func LanguageFlagValues() []string
- func MaybeAppRoot() (appRoot, relPath string, err error)
- func StartDaemonInBackground(ctx context.Context) error
- func StopDaemon()
- func StreamCommandOutput(stream CommandOutputStream, converter OutputConverter) int
- func WorkspaceRoot(appRoot string) string
- type CommandOutputStream
- type ConvertLogOption
- type ConvertLogOptions
- type Language
- type Oneof
- type OutputConverter
- type Selectable
- type SelectedID
- type SimpleSelectDone
- type SimpleSelectModel
Constants ¶
const ( CodeBlue = "#6D89FF" CodePurple = "#A36C8C" CodeGreen = "#B3D77E" ValidationFail = "#CB1010" )
Variables ¶
var ( ErrNoEncoreApp = errors.New("no encore.app found in directory (or any of the parent directories)") ErrEncoreAppIsDir = errors.New("encore.app is a directory, not a file") )
var ( InputStyle = lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{Dark: CodeBlue, Light: CodeBlue}) DescStyle = lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{Dark: CodeGreen, Light: CodePurple}) DocStyle = lipgloss.NewStyle().Padding(0, 2, 0, 2) ErrorStyle = lipgloss.NewStyle().Foreground(lipgloss.Color(ValidationFail)) SuccessStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#00C200")) )
var AllLanguages = []Language{ LanguageGo, LanguageTS, }
var Newline string
Functions ¶
func AppRoot ¶
func AppRoot() (appRoot, relPath string)
AppRoot is like MaybeAppRoot but instead of returning an error it prints it to stderr and exits.
func AppSlug ¶
func AppSlug() string
AppSlug reports the current app's app slug. It throws a fatal error if the app is not connected with the Encore Platform.
func AppSlugOrLocalID ¶ added in v1.47.0
func AppSlugOrLocalID() string
func AutoCompleteAppSlug ¶ added in v1.13.1
func AutoCompleteEnvSlug ¶ added in v1.13.1
func AutoCompleteFromStaticList ¶ added in v1.13.1
func ClearTerminalExceptFirstNLines ¶ added in v1.42.3
func ClearTerminalExceptFirstNLines(n int)
func ConnectDaemon ¶
func ConnectDaemon(ctx context.Context) daemonpb.DaemonClient
ConnectDaemon returns a client connection to the Encore daemon. By default, it will start the daemon if it is not already running.
func DisplayError ¶
func FindAppRootFromDir ¶ added in v1.47.0
func IsDaemonRunning ¶ added in v1.38.0
func LanguageFlagValues ¶ added in v1.52.1
func LanguageFlagValues() []string
func MaybeAppRoot ¶ added in v1.25.1
MaybeAppRoot determines the app root by looking for the "encore.app" file, initially in the current directory and then recursively in parent directories up to the filesystem root.
It reports the absolute path to the app root, and the relative path from the app root to the working directory.
func StartDaemonInBackground ¶
StartDaemonInBackground starts the Encore daemon in the background.
func StopDaemon ¶
func StopDaemon()
func StreamCommandOutput ¶ added in v1.42.3
func StreamCommandOutput(stream CommandOutputStream, converter OutputConverter) int
StreamCommandOutput streams the output from the given command stream, and reports the command's exit code. If convertJSON is true, lines that look like JSON are fed through zerolog's console writer.
func WorkspaceRoot ¶ added in v1.46.10
WorkspaceRoot determines the workspace root by looking for the .git folder in app root or parents to it. It reports the absolute path to the workspace root.
Types ¶
type CommandOutputStream ¶ added in v1.42.3
type CommandOutputStream interface {
Recv() (*daemon.CommandMessage, error)
}
CommandOutputStream is the interface for gRPC streams that stream the output of a command.
type ConvertLogOption ¶ added in v1.42.3
type ConvertLogOption func(*ConvertLogOptions)
func Colorize ¶ added in v1.42.3
func Colorize(enable bool) ConvertLogOption
type ConvertLogOptions ¶ added in v1.42.3
type ConvertLogOptions struct {
Color bool
}
type Language ¶ added in v1.52.1
type Language string
func (Language) SelectPrompt ¶ added in v1.52.1
type Oneof ¶ added in v1.25.0
type Oneof struct {
Value string
Allowed []string
Flag string // defaults to "output" if empty
FlagShort string // defaults to "o" if both Flag and FlagShort are empty
Desc string // usage desc
TypeDesc string // type description, defaults to the name of the flag
NoOptDefVal string // default value when no option is provided
}
func (*Oneof) Alternatives ¶ added in v1.25.0
Alternatives lists the alternatives in the format "a|b|c".
type OutputConverter ¶ added in v1.42.3
func ConvertJSONLogs ¶ added in v1.42.3
func ConvertJSONLogs(opts ...ConvertLogOption) OutputConverter
type Selectable ¶ added in v1.52.1
type Selectable interface {
comparable
SelectPrompt() string
}
type SelectedID ¶ added in v1.52.1
type SelectedID[T any] interface { SelectedID() T }
type SimpleSelectDone ¶ added in v1.52.1
type SimpleSelectDone[T any] struct { Selected T }
type SimpleSelectModel ¶ added in v1.52.1
type SimpleSelectModel[T Selectable, S SelectedID[T]] struct { Predefined T List list.Model }
func (SimpleSelectModel[T, S]) Selected ¶ added in v1.52.1
func (m SimpleSelectModel[T, S]) Selected() T
func (*SimpleSelectModel[T, I]) SetSize ¶ added in v1.52.1
func (m *SimpleSelectModel[T, I]) SetSize(width, height int)
func (SimpleSelectModel[T, I]) Update ¶ added in v1.52.1
func (m SimpleSelectModel[T, I]) Update(msg tea.Msg) (SimpleSelectModel[T, I], tea.Cmd)
func (SimpleSelectModel[T, I]) View ¶ added in v1.52.1
func (m SimpleSelectModel[T, I]) View() string