util

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2025 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Alert

func Alert(s string)

func Beep

func Beep(n int)

func Bell

func Bell(n int)

func CollectNetworkConfig

func CollectNetworkConfig() (map[string][]net.IP, error)

func Confirm

func Confirm(ps string, choices []string, defaultChoice string, in io.Reader) (string, error)

func DetectContentType

func DetectContentType(filePath string) (string, error)

func FormatContent

func FormatContent(format string, out *api.Output) (string, error)

func GetEnvVarNames

func GetEnvVarNames() string

func GetMemoryChipInfo

func GetMemoryChipInfo() (string, error)

func GetOSInfo

func GetOSInfo() (map[string]string, error)

GetOSInfo collects OS-specific release info

func GetRunningProcesses

func GetRunningProcesses() ([]string, error)

func GetShellInfo

func GetShellInfo() (map[string]string, error)

GetShellInfo determines the current shell and retrieves its version.

func IsExecutable

func IsExecutable(filePath string) bool

func ListCommands

func ListCommands() map[string]string

ListCommands returns the full path of the first valid executable command encountered in the PATH environment variable.

func Notify

func Notify(s string)

func PrintImage

func PrintImage(out io.Writer, imageFile string) error

func Prompt

func Prompt(ps string, in io.Reader) (string, error)

func Render

func Render(text string) string

func Uname

func Uname() (string, string)

uname -sm

func ViewImage

func ViewImage(imageFile string) error

The ViewImage function attempts to open an image file using an external viewer. It first checks for a custom viewer specified in the AI_IMAGE_VIEWER environment variable. If not set, it defaults to using platform-specific tools to view the image.

Types

type Clipboard

type Clipboard struct{}

func NewClipboard

func NewClipboard() *Clipboard

func (*Clipboard) Append

func (c *Clipboard) Append(text string) error

func (*Clipboard) Clear

func (c *Clipboard) Clear() error

func (*Clipboard) Get

func (c *Clipboard) Get() (string, error)

Get tries to read from clipboard it will return empty string if clipboard is empty

func (*Clipboard) Read

func (c *Clipboard) Read() (string, error)

Read reads from clipboard it will wait until clipboard has content

func (*Clipboard) Write

func (c *Clipboard) Write(text string) error

type CodeBlock

type CodeBlock struct {
	Language string
	Code     string
}

type CpuInfo

type CpuInfo struct {
	CPU       int32
	VendorID  string
	ModelName string
	Cores     int32
	Mhz       float64
	Usage     []float64
}

CpuInfo holds information about a CPU.

func GetCpuInfo

func GetCpuInfo() ([]CpuInfo, error)

GetCpuInfo retrieves and returns information about the CPUs.

type DiskInfo

type DiskInfo struct {
	Device      string
	MountPoint  string
	Filesystem  string
	Total       uint64
	Used        uint64
	Free        uint64
	UsedPercent float64
}

func GetDiskInfo

func GetDiskInfo() ([]DiskInfo, error)

GetDiskInfo retrieves info about the disk usage.

type MarkdownDoc

type MarkdownDoc struct {
	Title      string
	Contents   []string
	CodeBlocks []CodeBlock
}

func ParseMarkdown

func ParseMarkdown(markdownContent string) *MarkdownDoc

type MemoryStats

type MemoryStats struct {
	Total       uint64
	Available   uint64
	Used        uint64
	UsedPercent float64
}

func GetMemoryStats

func GetMemoryStats() (*MemoryStats, error)

GetMemoryStats retrieves info about the memory usage.

type SystemInfo

type SystemInfo struct {
	OS        string
	Arch      string
	OSInfo    map[string]string
	ShellInfo map[string]string

	UserInfo map[string]string

	EnvVarNames string
}

func CollectSystemInfo

func CollectSystemInfo() (*SystemInfo, error)

Jump to

Keyboard shortcuts

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