[][src]Module hm::config

Define our Config and Worker. Implement how to take the config.toml and turn it into a Config { files: Vec<ManagedObject> }. Describes the Worker object, which is how we communicate back to our main() thread about how our task is going.

Structs

Config

Represents just the file config.toml and contains a vector of things that shall become ManagedObjects.

ManagedObject

We're a super-set of all the kinds of ManagedObjects we can be. Just don't use the fields you don't wanna use. A simple ManagedObject is a name, source, destination, and method (currently only symlink). The simple ManagedObject would just be symlinked to its destination. Complex ManagedObjects include solutions, which are executed scripts.

Worker

Allow us to communicate meaningfully back to main() thread.

Functions

as_managed_objects

Convenience function that allows getting a HashMap from a Config of the ManagedObjects within.

deserialize_file

Open our config file and read the entire contents into hopefully valid toml. Either we gucci and return back a Config made of toml, or we explain what went wrong with the toml Err.

deserialize_files

This takes our file/task array and turns them into ManagedObjects, to be stuffed into the Config.

ensure_config_dir

Make sure $XDG_CONFIG_DIR exists. On Linux and similar this is /home/<username>/.config; macOS /Users/<username>/.config.

get_mo