plist-buddy-0.1.0.0: Remote monad for editing plists

Safe HaskellNone
LanguageHaskell2010

Database.PlistBuddy

Contents

Synopsis

Remote Monad

openPlist :: FilePath -> IO Plist Source

Open a specific Plist, returning a Plist handle.

data Plist Source

The Remote Plist

send :: Plist -> PlistBuddy a -> IO a Source

Send the (remote) PlistBuddy monad to given Plist.

throwPlistError :: PlistError -> PlistBuddy a Source

Throw a PlistError. Uncaught PlistError exceptions will be thrown by send as IO Exceptions.

catchPlistError :: PlistBuddy a -> (PlistError -> PlistBuddy a) -> PlistBuddy a Source

A version of catchError with the type specialized to PlistBuddy. Using this will cause a static error if used on a non-PlistBuddy monad.

The Remote Monad operators

help :: PlistBuddy Text Source

Returns Help Text

exit :: PlistBuddy () Source

Exits the program, changes are not saved to the file

save :: PlistBuddy () Source

Saves the current changes to the file

revert :: PlistBuddy () Source

Reloads the last saved version of the file

clear :: Value -> PlistBuddy () Source

Clear Type - Clears out all existing entries, and creates root of a value, where the value is an empty Dict or Array.

get :: [Text] -> PlistBuddy Value Source

Print Entry - Gets value of Entry.

set :: [Text] -> Value -> PlistBuddy () Source

Set Entry Value - Sets the value at Entry to Value You can not set dictionaries or arrays.

add :: [Text] -> Value -> PlistBuddy () Source

Add Entry Type [Value] - Adds Entry to the plist, with value Value You can add *empty* dictionaries or arrays.

delete :: [Text] -> PlistBuddy () Source

Delete Entry - Deletes Entry from the plist

Other types

Debugging

debugOn :: Plist -> Plist Source

Generate a version of Plist that outputs debuging information.

Exception

Audit

data Trail Source

Constructors

Save ByteString

hash code of saved file

Revert 
Exit 
Clear Value 
Set [Text] Value 
Add [Text] Value 
Delete [Text] 
Start ByteString

hash code at start of audit capture

auditOff :: Plist -> IO () Source

Turn off audit.

replay :: Trail -> PlistBuddy () Source

replay invokes the respective PlistBuddy function. It is uses when replying an audit replay.

recover :: FilePath -> IO [AuditTrail] Source

Find the list of PlistBuddy commands to recover the plist. Be careful when running recover with the audit capability turned on; it can duplicate the audit trail, because recovery is also write. (This should not break anything)

Background version of Plist

data BackgroundPlist Source

This is a version of Plist that saves the database on regular occasions, and suspends itself when not used.

backgroundPlist :: Int -> IO Plist -> IO BackgroundPlist Source

This creates a background Plist. The Int argument is the number of seconds to wait before saveing and sleeping the Plist. The 'IO Plist' may be called many times.

bgSend :: BackgroundPlist -> PlistBuddy a -> IO a Source

Send a command to a background Plist. The semantics of bgSend is the same as saving after every command, provided you wait long enough.

bgAutoSave :: BackgroundPlist -> IO () Source

Save (if needed) and exit. The BackgroundPlist goes to sleep.