plist

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package plist provides utilities for generating macOS property list files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EscapeXML

func EscapeXML(s string) string

EscapeXML escapes special characters for XML content. This function handles the basic XML entities that need to be escaped when embedding content in XML documents.

func GenerateDefaultBundleID

func GenerateDefaultBundleID(appName string) string

GenerateDefaultBundleID creates a default bundle ID based on the app name. Uses the same inference logic as the helpers/bundle package.

func PermissionDescription

func PermissionDescription(perm Permission) string

PermissionDescription returns a human-readable description of a permission.

func ValidateAppGroups

func ValidateAppGroups(appGroups []string) error

ValidateAppGroups validates app group identifiers.

func ValidatePermissions

func ValidatePermissions(permissions []Permission) error

ValidatePermissions checks if all provided permissions are recognized.

func WriteEntitlements

func WriteEntitlements(path string, cfg EntitlementsConfig) error

WriteEntitlements creates an entitlements.plist file at the specified path. It generates entitlements based on the provided permissions, custom entitlements, and app groups.

func WriteInfoPlist

func WriteInfoPlist(path string, cfg InfoPlistConfig) error

WriteInfoPlist creates a minimal Info.plist file at the specified path. It generates a standard macOS app bundle Info.plist with required keys.

Types

type EntitlementsConfig

type EntitlementsConfig struct {
	Permissions   []Permission
	Custom        []string
	CustomStrings map[string]string
	CustomArrays  map[string][]string
	AppGroups     []string
}

EntitlementsConfig holds configuration for generating entitlements.plist files.

type InfoPlistConfig

type InfoPlistConfig struct {
	AppName        string
	BundleID       string
	ExecName       string
	Version        string
	BackgroundOnly bool
	CustomKeys     map[string]interface{}
}

InfoPlistConfig holds configuration for generating Info.plist files.

type Permission

type Permission string

Permission represents a macOS system permission that can be requested. These correspond to TCC (Transparency, Consent, Control) permission types.

const (
	Camera     Permission = "camera"     // Camera access (com.apple.security.device.camera)
	Microphone Permission = "microphone" // Microphone access (com.apple.security.device.audio-input)
	Location   Permission = "location"   // Location services (com.apple.security.personal-information.location)
	Files      Permission = "files"      // File system access with user selection
	Network    Permission = "network"    // Network client/server access
	Sandbox    Permission = "sandbox"    // App sandbox with restricted file access
)

Core permissions covering 95% of use cases.

func GetAvailablePermissions

func GetAvailablePermissions() []Permission

GetAvailablePermissions returns all available standard permissions.

Jump to

Keyboard shortcuts

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