utils

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ConsoleColors consoleColors = consoleColors{
		NormalBlack:   "\033[38;5;0m  \033[0m",
		NormalRed:     "\033[38;5;1m  \033[0m",
		NormalGreen:   "\033[38;5;2m  \033[0m",
		NormalYellow:  "\033[38;5;3m  \033[0m",
		NormalBlue:    "\033[38;5;4m  \033[0m",
		NormalMagenta: "\033[38;5;5m  \033[0m",
		NormalCyan:    "\033[38;5;6m  \033[0m",
		NormalWhite:   "\033[38;5;7m  \033[0m",
		BrightBlack:   "\033[48;5;0m  \033[0m",
		BrightRed:     "\033[48;5;1m  \033[0m",
		BrightGreen:   "\033[48;5;2m  \033[0m",
		BrightYellow:  "\033[48;5;3m  \033[0m",
		BrightBlue:    "\033[48;5;4m  \033[0m",
		BrightMagenta: "\033[48;5;5m  \033[0m",
		BrightCyan:    "\033[48;5;6m  \033[0m",
		BrightWhite:   "\033[48;5;7m  \033[0m"}
	QRCodeRecoveryLevels = qrcodeRecoveryLevels{
		Low:     qrcodeRecoveryLevel(qrcode.Low),
		Medium:  qrcodeRecoveryLevel(qrcode.Medium),
		High:    qrcodeRecoveryLevel(qrcode.High),
		Highest: qrcodeRecoveryLevel(qrcode.Highest)}
)

Functions

func ContainsString

func ContainsString(slice []string, str string) bool

containsString function checks if a string is present in a slice

func FormatHumanDate

func FormatHumanDate(dateTime time.Time) string

func FormatSize

func FormatSize(size int64) string

func GenerateRandomString

func GenerateRandomString(length int) string

generateRandomString generates a random string of the specified length

func QRNew added in v0.2.1

func QRNew() *qrcodeTerminal

func QRNew2 added in v0.2.1

func QRNew2(front, back consoleColor, level qrcodeRecoveryLevel) *qrcodeTerminal

func RenameFileToUnique

func RenameFileToUnique(filename string) string

func SplitFile

func SplitFile(filename string) (string, string)

Split the file in basename and extension

Types

type QRCodeString added in v0.2.1

type QRCodeString string

func (*QRCodeString) Print added in v0.2.1

func (v *QRCodeString) Print()

Jump to

Keyboard shortcuts

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