Documentation
¶
Index ¶
- Constants
- Variables
- func NewHandler(repoClient repo.ClientInterface, configService config.ServiceInterface, ...) interfaces.ProjectHandler
- func NewHandlerWithRegionSelector(repoClient repo.ClientInterface, configService config.ServiceInterface, ...) interfaces.ProjectHandler
- type BubbleteeRegionSelector
- type Cmd
- type CreateCmd
- type DeleteCmd
- type Handler
- func (h *Handler) Create(ctx context.Context, org models.Organization, flags models.CreateProjectFlags) (models.Project, error)
- func (h *Handler) Delete(ctx context.Context, project models.Project) error
- func (h *Handler) HandleSwitch(ctx context.Context, org models.Organization) error
- func (h *Handler) PreCreateUpdateValidation(printError bool) (string, string, error)
- func (h *Handler) PrintNoProjectsInOrganization()
- func (h *Handler) Switch(ctx context.Context, flags models.SwitchProjectFlags, org models.Organization, ...) (models.Project, error)
- func (h *Handler) Update(ctx context.Context, project models.Project, org models.Organization, ...) error
- type MockHandler
- func (m *MockHandler) Create(ctx context.Context, org models.Organization, flags models.CreateProjectFlags) (models.Project, error)
- func (m *MockHandler) Delete(ctx context.Context, project models.Project) error
- func (m *MockHandler) HandleSwitch(ctx context.Context, org models.Organization) error
- func (m *MockHandler) PreCreateUpdateValidation(printError bool) (string, string, error)
- func (m *MockHandler) PrintNoProjectsInOrganization()
- func (m *MockHandler) Switch(ctx context.Context, flags models.SwitchProjectFlags, org models.Organization, ...) (models.Project, error)
- func (m *MockHandler) Update(ctx context.Context, project models.Project, org models.Organization, ...) error
- type MockRegionSelector
- type RegionSelector
- type SwitchCmd
- type UpdateCmd
Constants ¶
View Source
const MaxProjectNameLen = 50
Variables ¶
View Source
var CmdPlugin struct { Project *Cmd `cmd:"" aliases:"proj" group:"Project Commands:" help:"Manage your projects"` }
View Source
var (
ErrCannotCreateSwitchProject = eris.New("Cannot create/switch Project, directory belongs to another project.")
)
Functions ¶
func NewHandler ¶
func NewHandler( repoClient repo.ClientInterface, configService config.ServiceInterface, apiClient api.ClientInterface, inputService input.ServiceInterface, ) interfaces.ProjectHandler
func NewHandlerWithRegionSelector ¶
func NewHandlerWithRegionSelector( repoClient repo.ClientInterface, configService config.ServiceInterface, apiClient api.ClientInterface, inputService input.ServiceInterface, regionSelector RegionSelector, ) interfaces.ProjectHandler
NewHandlerWithRegionSelector creates a new project handler with a custom region selector. This is used for testing purposes to inject a mock region selector.
Types ¶
type BubbleteeRegionSelector ¶
type BubbleteeRegionSelector struct{}
BubbleteeRegionSelector implements RegionSelector using bubbletea TUI.
func (*BubbleteeRegionSelector) SelectRegions ¶
type Cmd ¶
type Cmd struct {
Create *CreateCmd `cmd:"" group:"Project Commands:" help:"Create a new project"`
Switch *SwitchCmd `cmd:"" group:"Project Commands:" help:"Switch to a different project"`
Update *UpdateCmd `cmd:"" group:"Project Commands:" help:"Update your project"`
Delete *DeleteCmd `cmd:"" group:"Project Commands:" help:"Delete your project"`
}
type CreateCmd ¶
type DeleteCmd ¶
type DeleteCmd struct {
Context context.Context `kong:"-"`
Dependencies cmdsetup.Dependencies `kong:"-"`
}
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func (*Handler) Create ¶
func (h *Handler) Create( ctx context.Context, org models.Organization, flags models.CreateProjectFlags, ) (models.Project, error)
func (*Handler) HandleSwitch ¶
HandleSwitch manages the project selection logic.
func (*Handler) PreCreateUpdateValidation ¶
PreCreateUpdateValidation returns the repo path and URL, and an error.
func (*Handler) PrintNoProjectsInOrganization ¶
func (h *Handler) PrintNoProjectsInOrganization()
type MockHandler ¶
func (*MockHandler) Create ¶
func (m *MockHandler) Create( ctx context.Context, org models.Organization, flags models.CreateProjectFlags, ) (models.Project, error)
func (*MockHandler) HandleSwitch ¶
func (m *MockHandler) HandleSwitch(ctx context.Context, org models.Organization) error
func (*MockHandler) PreCreateUpdateValidation ¶
func (m *MockHandler) PreCreateUpdateValidation(printError bool) (string, string, error)
func (*MockHandler) PrintNoProjectsInOrganization ¶
func (m *MockHandler) PrintNoProjectsInOrganization()
func (*MockHandler) Switch ¶
func (m *MockHandler) Switch( ctx context.Context, flags models.SwitchProjectFlags, org models.Organization, enableCreation bool, ) (models.Project, error)
func (*MockHandler) Update ¶
func (m *MockHandler) Update( ctx context.Context, project models.Project, org models.Organization, flags models.UpdateProjectFlags, ) error
type MockRegionSelector ¶
type MockRegionSelector struct {
// contains filtered or unexported fields
}
MockRegionSelector implements RegionSelector for testing.
func NewMockRegionSelector ¶
func NewMockRegionSelector(selectedRegions []string, err error) *MockRegionSelector
func (*MockRegionSelector) SelectRegions ¶
type RegionSelector ¶
type RegionSelector interface {
SelectRegions(ctx context.Context, regions []string, selectedRegions []string) ([]string, error)
}
RegionSelector interface for selecting regions.
type SwitchCmd ¶
type SwitchCmd struct {
Context context.Context `kong:"-"`
Dependencies cmdsetup.Dependencies `kong:"-"`
Slug string ` flag:"" help:"The slug of the project to switch to"`
}
type UpdateCmd ¶
type UpdateCmd struct {
Context context.Context `kong:"-"`
Dependencies cmdsetup.Dependencies `kong:"-"`
Name string ` flag:"" help:"The new name of the project"`
Slug string ` flag:"" help:"The new slug of the project"`
AvatarURL string ` flag:"" help:"The new avatar URL of the project" type:"url"`
}
Click to show internal directories.
Click to hide internal directories.