utils

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains added in v0.2.0

func Contains(s, substring string) bool

Contains checks if a string contains another string

func CreateSCMProvider added in v0.4.0

func CreateSCMProvider(repoInfo *SharedRepoInfo) (services.SCMProvider, error)

CreateSCMProvider creates the appropriate SCM provider for the repository

func ExtractIssueInfo added in v0.6.1

func ExtractIssueInfo(branchName string) (string, int, error)

ExtractIssueInfo extracts the project name (optional) and issue number from a branch name. Branch names can be in the format:

  • 123-branch-name (same repo)
  • project-123-branch-name (cross-repo)

Returns: (projectName, issueNumber, error) If projectName is empty, the issue is in the same repo as the branch.

func ExtractIssueNumber

func ExtractIssueNumber(branchName string) (int, error)

ExtractIssueNumber extracts the issue number from a branch name. Branch names are typically in the format 123-branch-name or project-123-branch-name. This function is kept for backward compatibility and uses ExtractIssueInfo internally.

func GenerateMilestone

func GenerateMilestone(t time.Time) string

GenerateMilestone creates a milestone string in the format YYYY.QN based on the provided time For example: 2025.Q1 for January-March, 2025.Q2 for April-June, etc.

func GetReadyLabel added in v0.4.0

func GetReadyLabel(cfg *config.Settings, repo *config.Repository, overrideLabel string) string

GetReadyLabel returns the appropriate ready label for the repository

func GetReadyStatus added in v0.4.1

func GetReadyStatus(cfg *config.Settings, repo *config.Repository, overrideStatus string) string

GetReadyStatus returns the appropriate ready status for the repository

func GetUnreadyLabel added in v0.4.1

func GetUnreadyLabel(cfg *config.Settings, repo *config.Repository, overrideLabel string) string

GetUnreadyLabel returns the appropriate unready label for the repository

func GetUnreadyStatus added in v0.4.1

func GetUnreadyStatus(cfg *config.Settings, repo *config.Repository, overrideStatus string) string

GetUnreadyStatus returns the appropriate unready status for the repository

func HandleLabelAndStatusOperation added in v0.4.1

func HandleLabelAndStatusOperation(operation LabelOperation, overrideLabel string, overrideStatus string) error

HandleLabelAndStatusOperation handles adding or removing labels from an issue and updating status

func HandleLabelAndStatusOperationWithUnready added in v0.4.1

func HandleLabelAndStatusOperationWithUnready(operation LabelOperation, overrideLabel string, overrideStatus string, overrideUnreadyLabel string) error

HandleLabelAndStatusOperationWithUnready handles adding or removing labels from an issue and updating status, with unready label support

func HandleLabelOperation added in v0.4.0

func HandleLabelOperation(operation LabelOperation, overrideLabel string) error

HandleLabelOperation handles adding or removing labels from an issue and updating status

func OpenURL

func OpenURL(url string) error

OpenURL opens a URL in the default browser

func SplitOnCommaAndWhitespace

func SplitOnCommaAndWhitespace(s string) []string

SplitOnCommaAndWhitespace splits a string on commas and trims whitespace

func TruncateAndDashCase

func TruncateAndDashCase(s string, maxLen int) string

TruncateAndDashCase converts a string to dash-case and truncates it to the specified length Keeps consecutive uppercase letters together (e.g., "IRSA" stays as "irsa", not "i-r-s-a")

Types

type LabelOperation added in v0.4.0

type LabelOperation int

LabelOperation represents the type of label operation

const (
	AddLabel LabelOperation = iota
	RemoveLabel
)

type SharedRepoInfo added in v0.4.0

type SharedRepoInfo struct {
	Repo        *config.Repository
	Name        string
	IsGitLab    bool
	CurrentDir  string
	IssueNumber int
	Branch      string
}

SharedRepoInfo holds information about a selected repository and related data

func SelectSharedRepository added in v0.4.0

func SelectSharedRepository() (*SharedRepoInfo, error)

SelectSharedRepository determines which repository to work with using shared logic

Jump to

Keyboard shortcuts

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