utils

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsPathWithExpansion

func AbsPathWithExpansion(p string) (string, error)

AbsPathWithExpansion expand path beginning with "~/" to absolute path

func AddDraftPrefix

func AddDraftPrefix(title string) string

AddDraftPrefix returns title with a "WIP: " prefix, or title unchanged if it already carries a recognized draft prefix.

func ArgToIndex

func ArgToIndex(arg string) (int64, error)

ArgToIndex take issue/pull index as string and return int64

func ArgsToIndices

func ArgsToIndices(args []string) ([]int64, error)

ArgsToIndices take issue/pull index as string and returns int64s

func Contains

func Contains(haystack []string, needle string) bool

Contains checks containment

func DirExists

func DirExists(path string) (bool, error)

DirExists returns whether the given file exists or not

func FileExist

func FileExist(fileName string) (bool, error)

FileExist returns whether the given file exists or not

func GetOwnerAndRepo

func GetOwnerAndRepo(repoPath, user string) (string, string)

GetOwnerAndRepo return repoOwner and repoName based on relative path and default owner (if not in path)

func HasDraftPrefix

func HasDraftPrefix(title string) bool

HasDraftPrefix reports whether title already starts with a draft marker.

func IndexOf

func IndexOf(haystack []string, needle string) int

IndexOf returns the index of first occurrence of needle in haystack

func IsKeyEncrypted

func IsKeyEncrypted(sshKey string) (bool, error)

IsKeyEncrypted checks if the key is encrypted

func NormalizeURL

func NormalizeURL(raw string) (*url.URL, error)

NormalizeURL normalizes the input with a protocol

func PathExists

func PathExists(path string) (bool, error)

PathExists returns whether the given file or directory exists or not

func ReadValue

func ReadValue(cmd *cli.Command, opts ReadValueOptions) (string, error)

ReadValue reads a value from various sources in the following priority order: 1. From a file specified by --file flag 2. From stdin if --stdin flag is set 3. From command arguments (second argument) 4. Interactive prompt

func StripDraftPrefix

func StripDraftPrefix(title string) string

StripDraftPrefix returns title with any recognized leading draft prefix removed, or title unchanged if no prefix is present.

func ValidateAuthenticationMethod

func ValidateAuthenticationMethod(
	giteaURL string,
	token string,
	user string,
	passwd string,
	sshAgent bool,
	sshKey string,
	sshCertPrincipal string,
) (*url.URL, error)

ValidateAuthenticationMethod checks the provided authentication method parameters

Types

type ReadValueOptions

type ReadValueOptions struct {
	// ResourceName is the name of the resource (e.g., "secret", "variable")
	ResourceName string
	// PromptMsg is the message to display when prompting interactively
	PromptMsg string
	// Hidden determines if the input should be hidden (for secrets/passwords)
	Hidden bool
	// AllowEmpty determines if empty values are allowed
	AllowEmpty bool
}

ReadValueOptions contains options for reading a value from various sources

Jump to

Keyboard shortcuts

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