cli

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvCommand  = "COYOTE_COMMAND"
	EnvPort     = "COYOTE_PORT"
	EnvHost     = "COYOTE_HOST"
	EnvName     = "COYOTE_MIGRATION_NAME"
	EnvUsername = "COYOTE_SUPERADMIN_USERNAME"
	EnvEmail    = "COYOTE_SUPERADMIN_EMAIL"
	EnvPassword = "COYOTE_SUPERADMIN_PASSWORD"
	EnvFake     = "COYOTE_MIGRATE_FAKE"
	EnvTarget   = "COYOTE_MIGRATE_TARGET"
	EnvSteps    = "COYOTE_MIGRATE_STEPS"
	EnvNoInput  = "COYOTE_NO_INPUT"
	EnvForce    = "COYOTE_FORCE"
	EnvArgs     = "COYOTE_ARGS"
	EnvLocale   = "COYOTE_LOCALE"
	EnvStrict   = "COYOTE_STRICT"
	EnvUndo     = "COYOTE_MIGRATION_UNDO"
	EnvWorkers  = "COYOTE_JOB_WORKERS"
	EnvQueues   = "COYOTE_JOB_QUEUES"
)
View Source
const (
	NameStart           = "start"
	NameMigrate         = "migrate"
	NameSyncPermissions = "syncpermissions"
	NameCollectStatic   = "collectstatic"
	NameWorker          = "worker"
)
View Source
const NameCheckMessages = "checkmessages"
View Source
const NameCreateSuperadmin = "createsuperadmin"
View Source
const NameDBShell = "dbshell"
View Source
const NameMakeMessages = "makemessages"
View Source
const NameMakeMigrations = "makemigrations"
View Source
const NameRollback = "rollback"
View Source
const NameSQLMigrate = "sqlmigrate"
View Source
const NameShell = "shell"

Variables

View Source
var ErrIncompleteCatalog = errors.New("coyote/cli: translations are incomplete")
View Source
var ErrSchemaMissing = errors.New("coyote/cli: the users table does not exist yet")
View Source
var ErrServerNotRunning = errors.New("coyote/cli: server is not running")
View Source
var ErrUnknownCommand = errors.New("coyote/cli: unknown command")

Functions

func Args

func Args() []string

func Dispatch

func Dispatch(a Application) error

func Register

func Register(commands ...Command)

func ReportMigrationState

func ReportMigrationState(app Application)

func Requested

func Requested() string

func RequireServer

func RequireServer(addr string) error

func ServerRunning

func ServerRunning(addr string) bool

Types

type Application

type Application interface {
	Serve() error
	Config() settings.Settings
	Models() []model.Model
	DB() (*gorm.DB, error)
	AuthService() *auth.Service
	Log() *slog.Logger
}

type CheckMessages

type CheckMessages struct {
	Locale string
	Strict bool
}

func CheckMessagesFromEnv

func CheckMessagesFromEnv() CheckMessages

func (CheckMessages) Name

func (CheckMessages) Name() string

func (CheckMessages) Run

func (c CheckMessages) Run(ctx Context) error

func (CheckMessages) Summary

func (CheckMessages) Summary() string

type CollectStatic

type CollectStatic struct{}

func (CollectStatic) Name

func (CollectStatic) Name() string

func (CollectStatic) Run

func (CollectStatic) Run(ctx Context) error

func (CollectStatic) Summary

func (CollectStatic) Summary() string

type Command

type Command interface {
	Name() string
	Summary() string
	Run(Context) error
}

func Registered

func Registered() []Command

type Context

type Context struct {
	App Application
	Out io.Writer
	In  io.Reader
}

func (Context) Context

func (c Context) Context() context.Context

func (Context) Input

func (c Context) Input() io.Reader

func (Context) Interactive

func (c Context) Interactive() bool

func (Context) ReadSecret

func (c Context) ReadSecret(label string) (string, bool, error)

type CreateSuperadmin

type CreateSuperadmin struct {
	Username string
	Email    string
	Password string
}

func (CreateSuperadmin) Name

func (CreateSuperadmin) Name() string

func (CreateSuperadmin) Run

func (c CreateSuperadmin) Run(ctx Context) error

func (CreateSuperadmin) Summary

func (CreateSuperadmin) Summary() string

type DBShell

type DBShell struct{}

func (DBShell) Name

func (DBShell) Name() string

func (DBShell) Run

func (DBShell) Run(ctx Context) error

func (DBShell) Summary

func (DBShell) Summary() string

type JobWorker

type JobWorker interface {
	Worker(workers int, queues []string) (*jobs.Runner, error)
}

type MakeMessages

type MakeMessages struct {
	Locale string
}

func MakeMessagesFromEnv

func MakeMessagesFromEnv() MakeMessages

func (MakeMessages) Name

func (MakeMessages) Name() string

func (MakeMessages) Run

func (m MakeMessages) Run(ctx Context) error

func (MakeMessages) Summary

func (MakeMessages) Summary() string

type MakeMigrations

type MakeMigrations struct {
	Label   string
	Undo    bool
	NoInput bool
}

func MakeMigrationsFromEnv

func MakeMigrationsFromEnv() MakeMigrations

func (MakeMigrations) Name

func (MakeMigrations) Name() string

func (MakeMigrations) Run

func (m MakeMigrations) Run(ctx Context) error

func (MakeMigrations) Summary

func (MakeMigrations) Summary() string

type Migrate

type Migrate struct {
	Fake        bool
	FakeInitial bool
	Target      string
}

func MigrateFromEnv

func MigrateFromEnv() Migrate

func (Migrate) Name

func (Migrate) Name() string

func (Migrate) Run

func (m Migrate) Run(ctx Context) error

func (Migrate) Summary

func (Migrate) Summary() string

type PermissionSyncer

type PermissionSyncer interface {
	SyncPermissions(ctx context.Context) (auth.SyncReport, error)
}

type Registry

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

func Default

func Default() *Registry

func NewRegistry

func NewRegistry(commands ...Command) *Registry

func (*Registry) Add

func (r *Registry) Add(commands ...Command)

func (*Registry) Lookup

func (r *Registry) Lookup(name string) (Command, bool)

func (*Registry) Names

func (r *Registry) Names() []string

func (*Registry) Run

func (r *Registry) Run(ctx Context, name string) error

type Report

type Report struct {
	Created []string
	Stale   []string
}

type Rollback

type Rollback struct {
	Steps   int
	Force   bool
	NoInput bool
}

func RollbackFromEnv

func RollbackFromEnv() Rollback

func (Rollback) Name

func (Rollback) Name() string

func (Rollback) Run

func (c Rollback) Run(ctx Context) error

func (Rollback) Summary

func (Rollback) Summary() string

type SQLMigrate

type SQLMigrate struct{}

func (SQLMigrate) Name

func (SQLMigrate) Name() string

func (SQLMigrate) Run

func (SQLMigrate) Run(ctx Context) error

func (SQLMigrate) Summary

func (SQLMigrate) Summary() string

type Shell

type Shell struct{}

func (Shell) Name

func (Shell) Name() string

func (Shell) Run

func (Shell) Run(ctx Context) error

func (Shell) Summary

func (Shell) Summary() string

type Start

type Start struct{}

func (Start) Name

func (Start) Name() string

func (Start) Run

func (Start) Run(ctx Context) error

func (Start) Summary

func (Start) Summary() string

type SyncPermissions

type SyncPermissions struct{}

func (SyncPermissions) Name

func (SyncPermissions) Name() string

func (SyncPermissions) Run

func (SyncPermissions) Run(ctx Context) error

func (SyncPermissions) Summary

func (SyncPermissions) Summary() string

type Worker

type Worker struct {
	Workers int
	Queues  []string
}

func WorkerFromEnv

func WorkerFromEnv() Worker

func (Worker) Name

func (Worker) Name() string

func (Worker) Run

func (c Worker) Run(ctx Context) error

func (Worker) Summary

func (Worker) Summary() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL