Documentation
¶
Index ¶
- Constants
- func BoldText(text string) string
- func BoolToCheckbox(b bool) string
- func BoolToStatusColored(b bool) string
- func Colorize(color, text string) string
- func Danger(text string) string
- func DimText(text string) string
- func FormatBiometricCapabilities(result *BiometricCapabilities, format string) string
- func FormatBiometricCapabilitiesTable(result *BiometricCapabilities) string
- func FormatBytes(bytes uint64) string
- func FormatCPUUsage(result *CPUUsageResult, format string) string
- func FormatCPUUsageTable(result *CPUUsageResult) string
- func FormatMemory(result *MemoryResult, format string) string
- func FormatMemoryTable(result *MemoryResult) string
- func FormatOutput(data any, tableFunc func() string, format string) string
- func FormatProcessList(result *ProcessListResult, format string) string
- func FormatProcessListTable(result *ProcessListResult) string
- func FormatSecuritySummary(result *SecuritySummary, format string) string
- func FormatSecuritySummaryTable(result *SecuritySummary) string
- func Header(text string) string
- func Info(text string) string
- func IsBiometricsSupported() bool
- func Muted(text string) string
- func PadLeft(s string, width int) string
- func PadRight(s string, width int) string
- func ProgressBar(percent float64, width int) string
- func StripANSI(s string) string
- func Success(text string) string
- func TableBottom(widths ...int) string
- func TableRow(cols ...string) string
- func TableRowColored(cols ...string) string
- func TableSeparator(widths ...int) string
- func TableTop(widths ...int) string
- func UsageColor(percent float64) string
- func VisibleLen(s string) int
- func Warning(text string) string
- type BioSummary
- type BiometricCapabilities
- type BootSummary
- type CPUUsageResult
- type EncSummary
- type MemoryResult
- type ProcessInfo
- type ProcessListResult
- type SecuritySummary
- type TPMSummary
Constants ¶
const ( FormatJSON = "json" FormatTable = "table" )
OutputFormat constants
const ( Reset = "\033[0m" Bold = "\033[1m" Dim = "\033[2m" Italic = "\033[3m" Underline = "\033[4m" // Foreground colors Black = "\033[30m" Red = "\033[31m" Green = "\033[32m" Yellow = "\033[33m" Blue = "\033[34m" Magenta = "\033[35m" Cyan = "\033[36m" White = "\033[37m" // Bright foreground colors BrightBlack = "\033[90m" BrightRed = "\033[91m" BrightGreen = "\033[92m" BrightYellow = "\033[93m" BrightBlue = "\033[94m" BrightMagenta = "\033[95m" BrightCyan = "\033[96m" BrightWhite = "\033[97m" // Background colors BgBlue = "\033[44m" BgCyan = "\033[46m" BgWhite = "\033[47m" )
ANSI color codes
const ( IconCPU = "🖥️ " IconMemory = "💾" IconProcess = "⚙️ " IconCheck = "✓" IconCross = "✗" IconCircle = "●" IconDiamond = "◆" IconArrow = "→" IconBar = "█" IconBarLight = "░" IconBarMed = "▒" IconCore = "◉" IconPID = "⬡" IconStatus = "◈" IconWarning = "⚠️ " IconInfo = "ℹ️ " IconLock = "🔒" IconUnlock = "🔓" IconKey = "🔑" IconShield = "🛡️ " IconFingerprint = "👆" IconFace = "👤" IconApple = "🍎" IconChip = "🔲" )
UTF-8 icons
Variables ¶
This section is empty.
Functions ¶
func BoolToStatusColored ¶
BoolToStatusColored returns a colored status string
func FormatBiometricCapabilities ¶
func FormatBiometricCapabilities(result *BiometricCapabilities, format string) string
FormatBiometricCapabilities is not available on unsupported platforms
func FormatBiometricCapabilitiesTable ¶
func FormatBiometricCapabilitiesTable(result *BiometricCapabilities) string
FormatBiometricCapabilitiesTable is not available on unsupported platforms
func FormatBytes ¶
FormatBytes converts bytes to human-readable format
func FormatCPUUsage ¶
func FormatCPUUsage(result *CPUUsageResult, format string) string
FormatCPUUsage formats CPU usage in the specified format
func FormatCPUUsageTable ¶
func FormatCPUUsageTable(result *CPUUsageResult) string
FormatCPUUsageTable formats CPU usage as a colored table
func FormatMemory ¶
func FormatMemory(result *MemoryResult, format string) string
FormatMemory formats memory usage in the specified format
func FormatMemoryTable ¶
func FormatMemoryTable(result *MemoryResult) string
FormatMemoryTable formats memory usage as a colored table
func FormatOutput ¶
FormatOutput returns the result in the requested format (json or table)
func FormatProcessList ¶
func FormatProcessList(result *ProcessListResult, format string) string
FormatProcessList formats process list in the specified format
func FormatProcessListTable ¶
func FormatProcessListTable(result *ProcessListResult) string
FormatProcessListTable formats process list as a colored table
func FormatSecuritySummary ¶
func FormatSecuritySummary(result *SecuritySummary, format string) string
FormatSecuritySummary formats security summary in the specified format
func FormatSecuritySummaryTable ¶
func FormatSecuritySummaryTable(result *SecuritySummary) string
FormatSecuritySummaryTable formats security summary as a colored table
func IsBiometricsSupported ¶
func IsBiometricsSupported() bool
IsBiometricsSupported returns false on unsupported platforms
func ProgressBar ¶
ProgressBar creates a colored progress bar
func TableBottom ¶
TableBottom creates a bottom border for tables
func TableRowColored ¶
TableRowColored creates a colored table row
func TableSeparator ¶
TableSeparator creates a separator line for tables
func UsageColor ¶
UsageColor returns the appropriate color based on usage percentage
func VisibleLen ¶
VisibleLen calculates the visible display width of a string (excluding ANSI codes and accounting for wide characters like emojis)
Types ¶
type BioSummary ¶
type BioSummary struct {
Available bool `json:"available"`
Configured bool `json:"configured"`
Type string `json:"type"`
}
BioSummary contains biometrics summary info
type BiometricCapabilities ¶
type BiometricCapabilities struct {
TouchIDAvailable bool `json:"touch_id_available"`
TouchIDEnrolled bool `json:"touch_id_enrolled"`
FaceIDAvailable bool `json:"face_id_available"`
FaceIDEnrolled bool `json:"face_id_enrolled"`
BiometryType string `json:"biometry_type"`
Platform string `json:"platform"`
}
BiometricCapabilities contains detailed biometric capability information
func GetBiometricCapabilities ¶
func GetBiometricCapabilities() (*BiometricCapabilities, error)
GetBiometricCapabilities returns an error on unsupported platforms
type BootSummary ¶
BootSummary contains Secure Boot summary info
type CPUUsageResult ¶
type CPUUsageResult struct {
UsagePercent float64 `json:"usage_percent"`
PerCore []float64 `json:"per_core"`
}
CPUUsageResult contains CPU usage information
func GetCPUUsage ¶
func GetCPUUsage(ctx context.Context) (*CPUUsageResult, error)
GetCPUUsage returns current CPU usage
type EncSummary ¶
type EncSummary struct {
Enabled bool `json:"enabled"`
Type string `json:"type"`
Status string `json:"status"`
}
EncSummary contains encryption summary info
type MemoryResult ¶
type MemoryResult struct {
TotalBytes uint64 `json:"total_bytes"`
UsedBytes uint64 `json:"used_bytes"`
FreeBytes uint64 `json:"free_bytes"`
AvailableBytes uint64 `json:"available_bytes"`
UsedPercent float64 `json:"used_percent"`
TotalHuman string `json:"total_human"`
UsedHuman string `json:"used_human"`
AvailableHuman string `json:"available_human"`
}
MemoryResult contains memory usage information
type ProcessInfo ¶
type ProcessInfo struct {
PID int32 `json:"pid"`
Name string `json:"name"`
CPUPercent float64 `json:"cpu_percent"`
MemoryPercent float32 `json:"memory_percent"`
Status string `json:"status"`
}
ProcessInfo contains information about a single process
type ProcessListResult ¶
type ProcessListResult struct {
Processes []ProcessInfo `json:"processes"`
Total int `json:"total"`
}
ProcessListResult contains the process list result
func ListProcesses ¶
func ListProcesses(ctx context.Context, limit int) (*ProcessListResult, error)
ListProcesses returns a list of running processes
type SecuritySummary ¶
type SecuritySummary struct {
Platform string `json:"platform"`
OverallScore int `json:"overall_score"`
OverallStatus string `json:"overall_status"`
TPM *TPMSummary `json:"tpm"`
SecureBoot *BootSummary `json:"secure_boot"`
Encryption *EncSummary `json:"encryption"`
Biometrics *BioSummary `json:"biometrics"`
Recommendations []string `json:"recommendations,omitempty"`
}
SecuritySummary contains a unified security posture overview
func GetSecuritySummary ¶
func GetSecuritySummary() (*SecuritySummary, error)
GetSecuritySummary returns a unified security posture overview
type TPMSummary ¶
type TPMSummary struct {
Present bool `json:"present"`
Enabled bool `json:"enabled"`
Type string `json:"type"`
}
TPMSummary contains TPM summary info