internal

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2025 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Gitlab    serviceKind = "gitlab-tools"
	Bitbucket serviceKind = "bitbucket-tools"
)

Variables

View Source
var (
	// StatusStyles a map that combines emojis and styles
	StatusStyles = map[string]StatusProps{
		"created": {
			Emoji: "🆕",
			Style: lipgloss.NewStyle().Foreground(lipgloss.Color("#bf87e6")),
		},
		"pending": {
			Emoji: "⌛",
			Style: lipgloss.NewStyle().Foreground(lipgloss.Color("#FFA500")),
		},
		"preparing": {
			Emoji: "⚙",
			Style: lipgloss.NewStyle().Foreground(lipgloss.Color("#FFFF00")),
		},
		"waiting_for_resource": {
			Emoji: "⏳",
			Style: lipgloss.NewStyle().Foreground(lipgloss.Color("#00FFFF")),
		},
		"running": {
			Emoji: "🏃",
			Style: lipgloss.NewStyle().Foreground(lipgloss.Color("#00FF00")),
		},
		"running_with_artifacts": {
			Emoji: "📦",
			Style: lipgloss.NewStyle().Foreground(lipgloss.Color("#4682B4")),
		},
		"success": {
			Emoji: "✅",
			Style: lipgloss.NewStyle().Foreground(lipgloss.Color("#00FF00")),
		},
		"failed": {
			Emoji: "⛔",
			Style: lipgloss.NewStyle().Foreground(lipgloss.Color("#FF0000")),
		},
		"failed_with_warnings": {
			Emoji: "⚠",
			Style: lipgloss.NewStyle().Foreground(lipgloss.Color("#FFA07A")),
		},
		"canceled": {
			Emoji: "🚫",
			Style: lipgloss.NewStyle().Foreground(lipgloss.Color("#DC143C")),
		},
		"skipped": {
			Emoji: "⏭",
			Style: lipgloss.NewStyle().Foreground(lipgloss.Color("#D3D3D3")),
		},
		"manual": {
			Emoji: "✋",
			Style: lipgloss.NewStyle().Foreground(lipgloss.Color("#00CED1")),
		},
		"scheduled": {
			Emoji: "⏰",
			Style: lipgloss.NewStyle().Foreground(lipgloss.Color("#1E90FF")),
		},
		"deployed": {
			Emoji: "🚀",
			Style: lipgloss.NewStyle().Foreground(lipgloss.Color("#00FF00")),
		},
	}

	TableBorderStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#660066"))

	FocusedStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("205"))
	BlurredStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("240"))
	CursorStyle  = FocusedStyle
	NoStyle      = lipgloss.NewStyle()
	HelpStyle    = BlurredStyle
)

Functions

func EncodeHyperlink(href string, text string) string

func GetCurrentGitProjectName

func GetCurrentGitProjectName() (string, string, error)

func GetCurrentGitRef

func GetCurrentGitRef() (string, error)

func GetHeadBranch added in v0.2.0

func GetHeadBranch() (string, error)

func GetLastCommitMessage added in v0.2.0

func GetLastCommitMessage() (string, error)

Types

type CreatePRRequest added in v0.2.0

type CreatePRRequest struct {
	Title  string `json:"title"`
	Source struct {
		Branch struct {
			Name string `json:"name"`
		} `json:"branch"`
	} `json:"source"`
	Destination struct {
		Branch struct {
			Name string `json:"name"`
		} `json:"branch"`
	} `json:"destination"`
	CloseSourceBranch bool `json:"close_source_branch"`
}

type CreatePRResponse added in v0.2.0

type CreatePRResponse struct {
	Links struct {
		Self struct {
			Href string `json:"href"`
			Name string `json:"name"`
		} `json:"self"`
	} `json:"links"`
}

func CreatePR added in v0.2.0

func CreatePR(host, project string, title, description, sourceBranch, destinationBranch string, token Credentials) (CreatePRResponse, error)

type Credentials

type Credentials struct {
	User    string
	Service serviceKind
	// contains filtered or unexported fields
}

func (*Credentials) CliFlags

func (c *Credentials) CliFlags() []cli.Flag

func (*Credentials) Parse

func (c *Credentials) Parse(cCtx *cli.Context) (err error)

func (*Credentials) Token

func (c *Credentials) Token() string

type FakeTransport added in v0.2.0

type FakeTransport struct{}

func (*FakeTransport) RoundTrip added in v0.2.0

func (t *FakeTransport) RoundTrip(req *http.Request) (*http.Response, error)

type GitlabJob

type GitlabJob struct {
	ID       int64       `json:"id"`
	Status   string      `json:"status"`
	Stage    string      `json:"stage"`
	Name     string      `json:"name"`
	Coverage interface{} `json:"coverage"`
	Duration *float64    `json:"duration"`
	User     struct {
		Username string `json:"username"`
		Name     string `json:"name"`
	} `json:"user"`
	WebUrl string `json:"web_url"`
}

func GetLatestJobs

func GetLatestJobs(host, project string, pipelineID int, token Credentials) ([]GitlabJob, error)

func GetLatestTriggeredJobs

func GetLatestTriggeredJobs(host, project string, pipelineID int, token Credentials) ([]GitlabJob, error)

type GitlabPipeline

type GitlabPipeline struct {
	Id     int    `json:"id"`
	Ref    string `json:"ref"`
	WebUrl string `json:"web_url"`
}

func GetLatestPipeline

func GetLatestPipeline(host, project, ref string, token Credentials) (GitlabPipeline, error)

type HttpSettings added in v0.2.0

type HttpSettings struct {
	WithFakeHttpTransport bool
}

func (*HttpSettings) CliFlags added in v0.2.0

func (c *HttpSettings) CliFlags() []cli.Flag

func (*HttpSettings) Parse added in v0.2.0

func (c *HttpSettings) Parse(cCtx *cli.Context) (err error)

type RetryJobResponse added in v0.1.2

type RetryJobResponse struct {
	Name   string `json:"name"`
	WebUrl string `json:"web_url"`
}

func RetryJob added in v0.1.2

func RetryJob(host, project string, jobID int64, token Credentials) (RetryJobResponse, error)

type RunJobResponse added in v0.1.2

type RunJobResponse struct {
	Name   string `json:"name"`
	WebUrl string `json:"web_url"`
}

func RunJob added in v0.1.2

func RunJob(host, project string, jobID int64, token Credentials) (RunJobResponse, error)

type ServiceInfo added in v0.2.0

type ServiceInfo struct {
	Host          string
	RefName       string
	ProjectName   string
	LastCommitMsg string
	HeadBranch    string
}

func (*ServiceInfo) CliFlags added in v0.2.0

func (g *ServiceInfo) CliFlags() []cli.Flag

func (*ServiceInfo) Parse added in v0.2.0

func (g *ServiceInfo) Parse(cCtx *cli.Context) error

type StatusProps

type StatusProps struct {
	Emoji string
	Style lipgloss.Style
}

StatusProps a structure for status properties

Jump to

Keyboard shortcuts

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