utils

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsPathWithExpansion added in v0.6.0

func AbsPathWithExpansion(p string) (string, error)

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

func ArgToIndex added in v0.6.0

func ArgToIndex(arg string) (int64, error)

ArgToIndex take issue/pull index as string and return int64

func ArgsToIndices added in v0.10.0

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

ArgsToIndices take issue/pull index as string and returns int64s

func Contains added in v0.7.0

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

Contains checks containment

func DirExists added in v0.7.0

func DirExists(path string) (bool, error)

DirExists returns whether the given file exists or not

func FileExist added in v0.6.0

func FileExist(fileName string) (bool, error)

FileExist returns whether the given file exists or not

func GetOwnerAndRepo added in v0.6.0

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

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

func IndexOf added in v0.7.0

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

IndexOf returns the index of first occurrence of needle in haystack

func IsKeyEncrypted added in v0.10.0

func IsKeyEncrypted(sshKey string) (bool, error)

IsKeyEncrypted checks if the key is encrypted

func NormalizeURL added in v0.6.0

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

NormalizeURL normalizes the input with a protocol

func PathExists added in v0.5.0

func PathExists(path string) (bool, error)

PathExists returns whether the given file or directory exists or not

func ReadValue added in v0.12.0

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 ValidateAuthenticationMethod added in v0.11.0

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 added in v0.12.0

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