utils

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearAPIKey added in v0.5.0

func ClearAPIKey() error

ClearAPIKey removes the stored Gemini API key

func ConfirmWithPIN added in v1.1.0

func ConfirmWithPIN(message string) error

ConfirmWithPIN generates a PIN, displays it, and asks the user to confirm by entering it.

func CopyToClipboard added in v0.3.0

func CopyToClipboard(text string) error

CopyToClipboard copies text to clipboard

func FileExists

func FileExists(path string) bool

FileExists checks if a file exists

func GeneratePIN added in v0.6.0

func GeneratePIN() (string, error)

GeneratePIN generates a random 6-digit PIN

func GeneratePassword

func GeneratePassword(length int) (string, error)

GeneratePassword generates a random password of the specified length

func GeneratePasswordByType added in v0.3.0

func GeneratePasswordByType(length int, passwordType string) (string, error)

GeneratePasswordByType generates a password based on type

func GetAPIKey added in v0.5.0

func GetAPIKey() (string, error)

GetAPIKey retrieves the stored Gemini API key

func GetConfigDir added in v0.5.0

func GetConfigDir() (string, error)

GetConfigDir returns the directory for storing mayrlabs configuration

func HashFile added in v0.3.0

func HashFile(filePath, algorithm string) (string, error)

HashFile generates a hash of a file using the specified algorithm

func HashString

func HashString(input, algorithm string) (string, error)

HashString generates a hash of the input string using the specified algorithm. MD5 and SHA1 are supported for legacy compatibility but SHA256 is recommended. #nosec G401 - MD5/SHA1 are intentionally supported as user options

func PromptInput

func PromptInput(message string) (string, error)

PromptInput prompts the user for input with a message (legacy version)

func PromptMultiSelect added in v0.6.0

func PromptMultiSelect(message string, options []string) ([]string, error)

PromptMultiSelect prompts the user to select multiple items from a list

func PromptSelect added in v0.3.0

func PromptSelect(message string, options []string) (string, error)

PromptSelect prompts the user to select from a list of options

func ReadFile

func ReadFile(path string) (string, error)

ReadFile reads content from a file

func StoreAPIKey added in v0.5.0

func StoreAPIKey(apiKey string) error

StoreAPIKey stores the Gemini API key securely

func SurveyConfirm added in v0.4.0

func SurveyConfirm(message string, defaultValue bool) (bool, error)

SurveyConfirm prompts the user for a yes/no confirmation

func SurveyInput added in v0.4.0

func SurveyInput(message string, defaultValue string) (string, error)

SurveyInput prompts the user for input using survey

func SurveyMultiline added in v0.5.0

func SurveyMultiline(message string) (string, error)

SurveyMultiline prompts the user for multiline input

func SurveyPassword added in v0.5.0

func SurveyPassword(message string) (string, error)

SurveyPassword prompts the user for a password input

func WriteFile

func WriteFile(path, content string) error

WriteFile writes content to a file with proper error handling. Uses 0600 permissions for security (owner read/write only).

Types

This section is empty.

Jump to

Keyboard shortcuts

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