util

package
v1.4.438 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: MIT Imports: 9 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 GetDefaultConfigPath added in v1.4.256

func GetDefaultConfigPath() (string, error)

GetDefaultConfigPath returns the default path for the configuration file if it exists, otherwise returns an empty string.

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

Jump to

Keyboard shortcuts

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