docs.rs failed to build defaults-rs-0.3.4
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
defaults-rs
Near drop-in replacement for the macOS defaults
CLI with API bindings for Rust
Table of Contents
Key Features
- Use it as a direct replacement for
defaults
without hassle. - Read, write, delete, rename, import/export, and inspect preferences using the built-in async Rust API.
- Supports user and global domains, or any plist file path.
- Supports all plist value types (int, float, bool, string, arrays, dictionaries).
- Pretty-prints plist data close to the original
defaults
format. - Handles both binary and XML plist files transparently.
- Extensible.
Installation
Using brew
:
Using cargo
:
Using mise
:
# NOTE: This will compile the binary for your system.
Manual Build & Install
CLI Usage
The CLI command is drs
. It closely mimics the original defaults
tool.
Examples
Read a key (domain or path)
Write a key
Delete a key
Read the whole domain
List all entries in all domains containing word
View all domains
Use the global domain
Read the type of a key
Rename a key
Import/export a domain
Rust API
To access the developer-side API for defaults-rs
, run the following command and add it to your Cargo project:
Please refer to the API reference for more information about all the available functions.
Example
use ;
async
The API also provides unified batch functions which can significantly reduce the amount of I/O per read/write/delete if you want to do multiple queries.
use ;
async
Contributing
New pull requests and issues are always welcome. Please read the contribution guidelines for more information about certain parts of the codebase and/or how to form a structured pull request.
License
This project has been licensed under the MIT License.