types
packageAPI reference for the types
package.
Sign
Sign is a unique signature for the application
type Sign string
AppOptions
AppOptions contains options for creating a new Vanilla OS application
type AppOptions struct
Fields
| Name | Type | Description |
|---|---|---|
| RDNN | string | |
| Name | string | |
| Version | string | |
| LocalesFS | fs.FS | |
| DefaultLocale | string | |
| CLIOptions | *cliTypes.CLIOptions |
flag
type flag struct
Fields
| Name | Type | Description |
|---|---|---|
| Name | string | |
| Shorthand | string | |
| Usage | string |
BoolFlag
type BoolFlag struct
Fields
| Name | Type | Description |
|---|---|---|
| Value | bool |
StringFlag
type StringFlag struct
Fields
| Name | Type | Description |
|---|---|---|
| Value | string |
NewBoolFlag
Parameters
Returns
func NewBoolFlag(name, shorthand, usage string, value bool) BoolFlag
{
return BoolFlag{
flag: flag{
Name: name,
Shorthand: shorthand,
Usage: usage,
},
Value: value,
}
}
Uses
NewStringFlag
Parameters
Returns
func NewStringFlag(name, shorthand, usage, value string) StringFlag
{
return StringFlag{
flag: flag{
Name: name,
Shorthand: shorthand,
Usage: usage,
},
Value: value,
}
}
Uses
CLIOptions
CLIOptions contains options for creating a new command for the CLI.
type CLIOptions struct
Fields
| Name | Type | Description |
|---|---|---|
| Use | string | |
| Short | string | |
| Long | string |
ConfigOptions
ConfigOptions is a struct that holds the configuration options
type ConfigOptions struct
Fields
| Name | Type | Description |
|---|---|---|
| Domain | string | |
| Path | string | |
| Type | string | |
| Prefix | string |
Permission
Permission represents file permissions of a file
type Permission struct
Methods
Returns
func (Permission) String() string
{
boolToChar := func(b bool) string {
if b {
return "r"
}
return "-"
}
return fmt.Sprintf("%s%s%s%s%s%s%s%s%s",
boolToChar(p.OwnerRead), boolToChar(p.OwnerWrite), boolToChar(p.OwnerExecute),
boolToChar(p.GroupRead), boolToChar(p.GroupWrite), boolToChar(p.GroupExecute),
boolToChar(p.OthersRead), boolToChar(p.OthersWrite), boolToChar(p.OthersExecute),
)
}
Fields
| Name | Type | Description |
|---|---|---|
| OwnerRead | bool | |
| OwnerWrite | bool | |
| OwnerExecute | bool | |
| GroupRead | bool | |
| GroupWrite | bool | |
| GroupExecute | bool | |
| OthersRead | bool | |
| OthersWrite | bool | |
| OthersExecute | bool |
BaseInfo
BaseInfo contains the common fields for both disks and partitions
type BaseInfo struct
Fields
| Name | Type | Description |
|---|---|---|
| Path | string | |
| Size | int64 | |
| HumanSize | string | |
| Filesystem | string | |
| Mountpoint | string | |
| Label | string | |
| UUID | string | |
| PARTUUID | string |
PartitionInfo
PartitionInfo represents information about a disk partition
type PartitionInfo struct
DiskInfo
DiskInfo represents information about a disk
type DiskInfo struct
Fields
| Name | Type | Description |
|---|---|---|
| Partitions | []PartitionInfo |
FileInfo
FileInfo represents information about a file
type FileInfo struct
Fields
| Name | Type | Description |
|---|---|---|
| Path | string | |
| ParentPath | string | |
| IsDirectory | bool | |
| Size | int64 | |
| Permissions | Permission | |
| Extension | string |
Uses
FileDiffInfo
FileDiff represents the difference between two files.
type FileDiffInfo struct
Fields
| Name | Type | Description |
|---|---|---|
| AddedLines | []string | |
| RemovedLines | []string |
PCIDeviceMap
PCIDeviceMap represents a map of PCIDeviceMapVendor structs
type PCIDeviceMap []PCIDeviceMapVendor
PCIDeviceMapDevice
PCIDeviceMapDevice represents a PCI (Peripheral Component Interconnect)
device
type PCIDeviceMapDevice struct
Fields
| Name | Type | Description |
|---|---|---|
| ID | string | |
| Name | string |
PCIDeviceMapVendor
PCIDeviceMapVendor represents a PCI (Peripheral Component Interconnect)
vendor
type PCIDeviceMapVendor struct
Fields
| Name | Type | Description |
|---|---|---|
| ID | string | |
| Name | string | |
| Devices | []PCIDeviceMapDevice |
PCIDevice
PCIDevice represents a PCI (Peripheral Component Interconnect) device
type PCIDevice struct
Fields
| Name | Type | Description |
|---|---|---|
| ID | string | json:"id" |
| Class | string | json:"class" |
| Name | string | json:"name" |
| VendorName | string | json:"vendor_name" |
| Vendor | string | json:"vendor" |
| Device | string | json:"device" |
| SubsystemDevice | string | json:"subsystem_device" |
| SubsystemVendor | string | json:"subsystem_vendor" |
| Modalias | string | json:"modalias" |
Peripheral
Peripheral represents a system peripheral.
type Peripheral struct
Fields
| Name | Type | Description |
|---|---|---|
| ID | string | json:"id" |
| Name | string | json:"name" |
| Type | DeviceType | json:"type" |
Uses
BatteryStats
BatteryStats represents battery statistics
type BatteryStats struct
Fields
| Name | Type | Description |
|---|---|---|
| Capacity | int | json:"capacity" |
| CapacityDesign | int | json:"capacityDesign" |
| Percentage | int | json:"percentage" |
| Status | BatteryStatus | json:"status" |
| Voltage | int | json:"voltage" |
BatteryStatus
BatteryStatus represents the status of a battery
type BatteryStatus string
DeviceType
DeviceType represents a system device type
type DeviceType string
InputDevice
InputDevice represents an input device
type InputDevice struct
Fields
| Name | Type | Description |
|---|---|---|
| Name | string | json:"name" |
| Product | string | json:"product" |
ChassisType
ChassisType represents the standardized chassis type.
type ChassisType string
MachineInfo
MachineInfo contains various information about the current machine
type MachineInfo struct
Fields
| Name | Type | Description |
|---|---|---|
| ProductName | string | json:"productName" |
| Manufacturer | string | json:"manufacturer" |
| Version | string | json:"version" |
| Chassis | ChassisInfo | json:"chassis" |
| Bios | BiosInfo | json:"bios" |
| Board | BoardInfo | json:"board" |
ChassisInfo
ChassisInfo contains various information about the machine chassis
type ChassisInfo struct
Fields
| Name | Type | Description |
|---|---|---|
| ID | int | json:"id" |
| Type | ChassisType | json:"type" |
| Manufacturer | string | json:"manufacturer" |
| Version | string | json:"version" |
Uses
BiosInfo
BiosInfo contains various information about the machine bios
type BiosInfo struct
Fields
| Name | Type | Description |
|---|---|---|
| Vendor | string | json:"vendor" |
| Version | string | json:"version" |
| Release | string | json:"release" |
BoardInfo
BoardInfo contains various information about the machine board
type BoardInfo struct
Fields
| Name | Type | Description |
|---|---|---|
| ProductName | string | json:"product" |
| Manufacturer | string | json:"manufacturer" |
| Version | string | json:"version" |
DeviceType
DeviceType represents the type of media device (e.g., audio input/output).
type DeviceType string
MediaDevice
MediaDevice represents a system media device, typically parsed from wpctl.
type MediaDevice struct
Fields
| Name | Type | Description |
|---|---|---|
| ID | string | json:"id" |
| Name | string | json:"name" |
| Description | string | json:"description" |
| Type | DeviceType | json:"type" |
| IsDefault | bool | json:"is_default" |
Uses
VolumeInfo
VolumeInfo represents volume information, typically for the default sink/source.
type VolumeInfo struct
Fields
| Name | Type | Description |
|---|---|---|
| LevelPercent | int | json:"level_percent" |
| IsMuted | bool | json:"is_muted" |
DNSInfo
DNSInfo represents DNS (Domain Name System) information
type DNSInfo struct
Fields
| Name | Type | Description |
|---|---|---|
| Hostname | string | json:"hostname" |
| IPAddresses | []string | json:"ip_addresses" |
NetworkInterfaceInfo
NetworkInterfaceInfo represents information about a network interface
type NetworkInterfaceInfo struct
Fields
| Name | Type | Description |
|---|---|---|
| Name | string | json:"name" |
| HardwareAddr | string | json:"hardware_address" |
| IPAddresses | []string | json:"ip_addresses" |
| Status | NetworkInterfaceStatus | json:"status" |
| Running | bool | json:"running" |
| SupportsBroadcast | bool | json:"supports_broadcast" |
| SupportsMulticast | bool | json:"supports_multicast" |
| IsLoopback | bool | json:"is_loopback" |
| IsP2P | bool | json:"is_point_to_point" |
NetworkInterfaceStatus
NetworkInterfaceStatus represents the status of a network interface
type NetworkInterfaceStatus string
PortStatus
PortStatus represents the status of a network port
type PortStatus string
ConnectionInfo
ConnectionInfo represents information about an connection
type ConnectionInfo struct
Fields
| Name | Type | Description |
|---|---|---|
| LocalAddr | string | json:"local_address" |
| RemoteAddr | string | json:"remote_address" |
| State | ConnState | json:"state" |
Uses
ConnState
ConnState represents the status of a connection
type ConnState string
Notification
Notification represents a desktop notification.
type Notification struct
Fields
| Name | Type | Description |
|---|---|---|
| AppName | string | |
| Title | string | |
| Message | string | |
| Icon | string | |
| Timeout | int32 | |
| Action | NotificationAction |
NotificationAction
NotificationAction represents a desktop notification button.
type NotificationAction struct
Fields
| Name | Type | Description |
|---|---|---|
| Label | string | |
| Callback | func() |
NewNotification
NewNotification creates a new Notification instance.
Parameters
Returns
func NewNotification(appName, title, message, icon string, timeout int32, action ...NotificationAction) *Notification
{
var notificationAction NotificationAction
if len(action) > 0 {
notificationAction = action[0]
}
return &Notification{
AppName: appName,
Title: title,
Message: message,
Icon: icon,
Timeout: timeout,
Action: notificationAction,
}
}
NewNotificationAction
NewNotificationAction creates a new NotificationAction instance.
Parameters
Returns
func NewNotificationAction(label string, callback func()) NotificationAction
{
return NotificationAction{
Label: label,
Callback: callback,
}
}
Document
Document represents a roff document buffer.
type Document struct
Fields
| Name | Type | Description |
|---|---|---|
| Buffer | bytes.Buffer |
Process
Process represents information about a process
type Process struct
Fields
| Name | Type | Description |
|---|---|---|
| PID | int | json:"pid" |
| Name | string | json:"name" |
| State | string | json:"state" |
| PPID | int | json:"ppid" |
| Priority | int | json:"priority" |
| Nice | int | json:"nice" |
| Threads | int | json:"threads" |
| UID | int | json:"uid" |
| GID | int | json:"gid" |
SystemInfo
SystemInfo is a struct that contains information about the system
type SystemInfo struct
Fields
| Name | Type | Description |
|---|---|---|
| OS | string | |
| Version | string | |
| Codename | string | |
| Arch | string | |
| MachineType | MachineType |
Uses
Timezone
Timezone represents a supported timezone
type Timezone struct
Fields
| Name | Type | Description |
|---|---|---|
| Name | string | json:"name" |
| Location | string | json:"location" |
UserInfo
UserInfo represents information about a user
type UserInfo struct
Fields
| Name | Type | Description |
|---|---|---|
| UID | string | json:"uid" |
| GID | string | json:"gid" |
| Username | string | json:"username" |
| Name | string | json:"name" |
| HomeDir | string | json:"home_directory" |
| Shell | string | json:"shell" |
GroupInfo
GroupInfo represents information about a group
type GroupInfo struct
Fields
| Name | Type | Description |
|---|---|---|
| GID | string | json:"gid" |
| Name | string | json:"name" |
MachineType
MachineType is the representation of the type of machine
type MachineType string
OSReleaseInfo
OSReleaseInfo is a struct that contains information about the OS release
type OSReleaseInfo struct
Fields
| Name | Type | Description |
|---|---|---|
| Name | string | |
| Version | string | |
| Codename | string |