plistutil

package
v0.0.0-...-fd57926 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package plistutil provides utilities for working with property list files

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertFormat

func ConvertFormat(srcPath, dstPath string, dstFormat Format) error

ConvertFormat converts a plist file from one format to another

func DeleteValue

func DeleteValue(data map[string]interface{}, path string) bool

DeleteValue removes a value from the plist using a dot-notation path

func FormatToString

func FormatToString(format Format) string

FormatToString converts a Format enum to a string

func GetValue

func GetValue(data map[string]interface{}, path string) (interface{}, bool)

GetValue retrieves a value from the plist using a dot-notation path

func MergePlists

func MergePlists(base, overlay map[string]interface{}) map[string]interface{}

MergePlists merges two plists, with the second one taking precedence

func ReadPlist

func ReadPlist(path string) (map[string]interface{}, error)

ReadPlist reads a property list file and returns its contents as a map

func SetValue

func SetValue(data map[string]interface{}, path string, value interface{}) error

SetValue sets a value in the plist using a dot-notation path

func Validate

func Validate(path string) error

Validate checks if a file is a valid plist

func WritePlist

func WritePlist(path string, data map[string]interface{}, format Format) error

WritePlist writes data to a property list file in the specified format

Types

type Format

type Format int

Format represents the plist format

const (
	// FormatXML is the XML plist format
	FormatXML Format = iota
	// FormatBinary is the binary plist format
	FormatBinary
	// FormatOpenStep is the OpenStep plist format
	FormatOpenStep
	// FormatGNUStep is the GNUStep plist format
	FormatGNUStep
	// FormatAuto will auto-detect the format when reading
	FormatAuto
)

func DetectFormat

func DetectFormat(path string) (Format, error)

DetectFormat detects the format of a plist file

func StringToFormat

func StringToFormat(formatStr string) Format

StringToFormat converts a string to a Format enum

type PlistInfo

type PlistInfo struct {
	Path   string
	Format Format
	Data   map[string]interface{}
}

PlistInfo contains information about a property list

Jump to

Keyboard shortcuts

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