util

package
v1.4.254 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAbsolutePath

func GetAbsolutePath(path string) (string, error)

GetAbsolutePath resolves a given path to its absolute form, handling ~, ./, ../, UNC paths, and symlinks.

func IsSymlinkToDir

func IsSymlinkToDir(path string) bool

Helper function to check if a symlink points to a directory

func ReturnItem

func ReturnItem(item string) string

Types

type GroupItems

type GroupItems[I any] struct {
	Group string
	Items []I
}

func (*GroupItems[I]) ContainsItemBy

func (o *GroupItems[I]) ContainsItemBy(predicate func(item I) bool) (ret bool)

func (*GroupItems[I]) Count

func (o *GroupItems[I]) Count() int

type GroupsItemsSelector

type GroupsItemsSelector[I any] struct {
	SelectionLabel string
	GetItemKey     func(I) string

	GroupsItems []*GroupItems[I]
}

func NewGroupsItemsSelector

func NewGroupsItemsSelector[I any](selectionLabel string,
	getItemLabel func(I) string) *GroupsItemsSelector[I]

func (*GroupsItemsSelector[I]) AddGroupItems

func (o *GroupsItemsSelector[I]) AddGroupItems(group string, items ...I)

func (*GroupsItemsSelector[I]) FindGroupsByItem

func (o *GroupsItemsSelector[I]) FindGroupsByItem(item I) (groups []string)

func (*GroupsItemsSelector[I]) FindGroupsByItemFirst

func (o *GroupsItemsSelector[I]) FindGroupsByItemFirst(item I) (ret string)

func (*GroupsItemsSelector[I]) GetGroupAndItemByItemNumber

func (o *GroupsItemsSelector[I]) GetGroupAndItemByItemNumber(number int) (group string, item I, err error)

func (*GroupsItemsSelector[I]) HasGroup

func (o *GroupsItemsSelector[I]) HasGroup(group string) (ret bool)

func (*GroupsItemsSelector[I]) Print

func (o *GroupsItemsSelector[I]) Print(shellCompleteList bool)

type GroupsItemsSelectorString

type GroupsItemsSelectorString struct {
	*GroupsItemsSelector[string]
}

func NewGroupsItemsSelectorString

func NewGroupsItemsSelectorString(selectionLabel string) *GroupsItemsSelectorString

type OAuthStorage

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

OAuthStorage handles persistent storage of OAuth tokens

func NewOAuthStorage

func NewOAuthStorage() (*OAuthStorage, error)

NewOAuthStorage creates a new OAuth storage instance

func (*OAuthStorage) DeleteToken

func (s *OAuthStorage) DeleteToken(provider string) error

DeleteToken removes a stored OAuth token

func (*OAuthStorage) GetTokenPath

func (s *OAuthStorage) GetTokenPath(provider string) string

GetTokenPath returns the file path for a provider's OAuth token

func (*OAuthStorage) HasValidToken

func (s *OAuthStorage) HasValidToken(provider string, bufferMinutes int) bool

HasValidToken checks if a valid (non-expired) token exists for a provider

func (*OAuthStorage) LoadToken

func (s *OAuthStorage) LoadToken(provider string) (*OAuthToken, error)

LoadToken loads an OAuth token from disk

func (*OAuthStorage) SaveToken

func (s *OAuthStorage) SaveToken(provider string, token *OAuthToken) error

SaveToken saves an OAuth token to disk with proper permissions

type OAuthToken

type OAuthToken struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	ExpiresAt    int64  `json:"expires_at"`
	TokenType    string `json:"token_type"`
	Scope        string `json:"scope"`
}

OAuthToken represents stored OAuth token information

func (*OAuthToken) IsExpired

func (t *OAuthToken) IsExpired(bufferMinutes int) bool

IsExpired checks if the token is expired or will expire within the buffer time

Jump to

Keyboard shortcuts

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