util

package
v0.0.0-...-900bd8d Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package util provides function for utility

Package util provides function for utility

Package util provides function for utility

Package util provides function for utility

Package util provides function for utility

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Border

func Border(str string, style lipgloss.Style) string

Border returns string to use bubbletea

func ContainsMedia

func ContainsMedia(path string) bool

ContainsMedia :

func ConvertToSeconds

func ConvertToSeconds(s string) (seconds float64, err error)

ConvertToSeconds converts a string like 00:00:11.35 into seconds (11.35)

func CreateFile

func CreateFile(p string) (*os.File, error)

CreateFile create file with file path

func Exists

func Exists(p string) bool

Exists returns file existence

func GetConfigDir

func GetConfigDir() (string, error)

GetConfigDir returns $XDG_CONFIG_HOME directory

func GetConfigFilePath

func GetConfigFilePath() (string, error)

GetConfigFilePath returns config file path for `ffextractor`

func GetFileList

func GetFileList(p string) ([]string, error)

GetFileList returns file list

func GetFileListByExts

func GetFileListByExts(dir string, exts []string, threads int) ([]string, error)

GetFileListByExts returns file list filter by extension

func GetFileListByRegexp

func GetFileListByRegexp(dir string, pattern *regexp.Regexp, threads int) ([]string, error)

GetFileListByRegexp returns file list filter by regexp

func GetFilenameFromPath

func GetFilenameFromPath(path string) string

GetFilenameFromPath returns filename from path

func GetStringInBetween

func GetStringInBetween(str string, start string, end string) (result string)

GetStringInBetween returns empty string if no start or end string found

func IsAudioPath

func IsAudioPath(path string) bool

IsAudioPath :

func IsBoolean

func IsBoolean(value []byte) bool

IsBoolean checks if a slice of bytes is a boolean value

func IsExecutable

func IsExecutable(s fs.FileInfo) bool

IsExecutable returns whether a file has execution permissions

func IsFloat

func IsFloat(value []byte) bool

IsFloat checks if a slice of bytes is a float value

func IsInteger

func IsInteger(value []byte) bool

IsInteger checks if a slice of bytes is an integer

func IsMediaPath

func IsMediaPath(path string) bool

IsMediaPath :

func IsVideoPath

func IsVideoPath(path string) bool

IsVideoPath :

func PaddingRight

func PaddingRight(s string, l int) string

PaddingRight returns string layout for bubbletea

func ParseBoolean

func ParseBoolean(value []byte) (bool, error)

ParseBoolean converts raw bytes to a bool value

func ParseInteger

func ParseInteger(value []byte) (int64, error)

ParseInteger converts raw bytes to a int64 value

func ParseNumber

func ParseNumber(value []byte) (float64, error)

ParseNumber converts raw bytes to a float64 value

func ParseString

func ParseString(value []byte) (string, error)

ParseString converts raw bytes to a string value

func RemoveFile

func RemoveFile(p string) error

RemoveFile remove file with file path

func SecondsToString

func SecondsToString(seconds float64) string

SecondsToString seconds like 80 to a string like 00:01:20.00

func String

func String(v string) *string

String returns string

func TruncateString

func TruncateString(s string, l int) (string, bool)

TruncateString returns truncated string

func UnixHomeDir

func UnixHomeDir() (string, error)

UnixHomeDir returns $HOME directory

Types

type Type

type Type uint8

Type is a type of data, these types follow JSON type primitives, with an added type for whole numbers (integer)

const (
	// TypeUnknown is the default datatype, making for easier
	// errors when a datatype is expected
	TypeUnknown Type = iota
	// TypeNull specifies the null type
	TypeNull
	// TypeInteger specifies whole numbers
	TypeInteger
	// TypeNumber specifies numbers with decimal value
	TypeNumber
	// TypeBoolean species true/false values
	TypeBoolean
	// TypeString specifies text values
	TypeString
	// TypeObject maps string keys to values
	TypeObject
	// TypeArray is an ordered list of values
	TypeArray
	// TypeBytes is an ordered slice of bytes
	TypeBytes
)

func ParseType

func ParseType(value []byte) Type

ParseType examines a slice of bytes & attempts to determine it's type, starting with the more specific possible types, then falling back to more general types. ParseType always returns a type

func (Type) String

func (dt Type) String() string

String satsfies the stringer interface

type Version

type Version string

Version is value for semver

func (Version) Newer

func (v Version) Newer(r Version) bool

Newer returns whether up to date or not

Jump to

Keyboard shortcuts

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