utils

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureDir

func EnsureDir(path string) error

EnsureDir creates a directory if it doesn't exist

func ExpandPath

func ExpandPath(path string) string

ExpandPath expands ~ in path to home directory

func FileExists

func FileExists(path string) bool

FileExists checks if a file exists

func GenerateID

func GenerateID(tool, commandName, target string) string

GenerateID generates a unique ID for a session

func GenerateOutputDir

func GenerateOutputDir(baseDir, domain string) string

GenerateOutputDir generates a timestamped output directory name

func NormalizeURL

func NormalizeURL(rawURL string) string

NormalizeURL ensures URL has proper format

func ParseURL

func ParseURL(rawURL string) (protocol, domain string, err error)

ParseURL parses a URL and extracts protocol and domain

func PrintError

func PrintError(msg string)

PrintError prints an error message

func PrintInfo

func PrintInfo(msg string)

PrintInfo prints an info message

func PrintSuccess

func PrintSuccess(msg string)

PrintSuccess prints a success message

func PrintWarning

func PrintWarning(msg string)

PrintWarning prints a warning message

func PromptConfirm

func PromptConfirm(label string) (bool, error)

PromptConfirm prompts the user for confirmation

func PromptOutputDir

func PromptOutputDir(defaultDir string) (string, error)

PromptOutputDir prompts the user for an output directory

func PromptSelect

func PromptSelect(label string, items []string) (string, error)

PromptSelect prompts the user to select from a list

func ReadLines

func ReadLines(path string) ([]string, error)

ReadLines reads lines from a file

func SanitizeDomain

func SanitizeDomain(domain string) string

SanitizeDomain removes port from domain if present

func WriteFile

func WriteFile(path, content string) error

WriteFile writes content to a file

func WriteLines added in v1.1.0

func WriteLines(path string, lines []string) error

WriteLines writes lines to a file (one line per string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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