project

package
v1.9.0-test4 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2025 License: LGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

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

func (b *BubbleteeRegionSelector) SelectRegions(
	ctx context.Context,
	regions []string,
	selectedRegions []string,
) ([]string, error)

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 CreateCmd struct {
	Context      context.Context       `kong:"-"`
	Dependencies cmdsetup.Dependencies `kong:"-"`
	Name         string                `         flag:"" help:"The name of the project"`
	Slug         string                `         flag:"" help:"The slug of the project"`
}

func (*CreateCmd) Run

func (c *CreateCmd) Run() error

type DeleteCmd

type DeleteCmd struct {
	Context      context.Context       `kong:"-"`
	Dependencies cmdsetup.Dependencies `kong:"-"`
}

func (*DeleteCmd) Run

func (c *DeleteCmd) Run() error

type Handler

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

func (*Handler) Create

func (*Handler) Delete

func (h *Handler) Delete(
	ctx context.Context,
	project models.Project,
) error

func (*Handler) HandleSwitch

func (h *Handler) HandleSwitch(ctx context.Context, org models.Organization) error

HandleSwitch manages the project selection logic.

func (*Handler) PreCreateUpdateValidation

func (h *Handler) PreCreateUpdateValidation(printError bool) (string, string, error)

PreCreateUpdateValidation returns the repo path and URL, and an error.

func (*Handler) PrintNoProjectsInOrganization

func (h *Handler) PrintNoProjectsInOrganization()

func (*Handler) Switch

func (h *Handler) Switch(
	ctx context.Context,
	flags models.SwitchProjectFlags,
	org models.Organization,
	enableCreation bool,
) (models.Project, error)

func (*Handler) Update

func (h *Handler) Update(
	ctx context.Context,
	project models.Project,
	org models.Organization,
	flags models.UpdateProjectFlags,
) error

type MockHandler

type MockHandler struct {
	mock.Mock
}

func (*MockHandler) Create

func (*MockHandler) Delete

func (m *MockHandler) Delete(
	ctx context.Context,
	project 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

func (m *MockRegionSelector) SelectRegions(
	_ context.Context,
	_ []string,
	_ []string,
) ([]string, error)

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"`
}

func (*SwitchCmd) Run

func (c *SwitchCmd) Run() error

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"`
}

func (*UpdateCmd) Run

func (c *UpdateCmd) Run() error

Jump to

Keyboard shortcuts

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