~pkal/dirconf

9e3748a64ced2b04eb67167da3ec80bf088e5746 — Philip K 2 years ago c82731b
added initial readme
1 files changed, 46 insertions(+), 0 deletions(-)

A README.md
A README.md => README.md +46 -0
@@ 0,0 1,46 @@
dirconf
=======

`Dirconf` implements [Go] library for a simple configuration format,
that instead of storing everything in a file, uses the file system as
a hierarchical key-value storage.

Usage
-----

Initialise a configuration object as follows:

	conf, err := dirconf.Open("path/to/dir")

if `err` is nil, then `conf` shall be a valid configuration object.
This can now be used to retrieve values, as the following examples
demonstrate.

* Query a Boolean value with the key `active`:

		active, err := conf.Bool("active")

	The variable `active` will then and only then be true, if the file
	`path/to/dir/active` exists, regardless of it's content.

* Get the integer value `size` from the group `buffer`:

		i, err := conf.Int64("buffer", "size")

	in the file system, this would parse the contents of the file
	`/path/to/dir/buffer/size`, as an Integer. If it is not an
	Integer, `err` shall equal `dirconf.ErrWrongType`.
* Receive a file object as `*os.File` from the key `profile.jpg` in
  the group `user`, subgroup "hans":

		f, err := conf.File("user", "hans", "profile.jpg")

	If no such file exists, `err` shall equal `dirconf.ErrNoSuchKey`.

Legal
-----

`Dirconf` is distributed under CC0. See [LICENSE] for more details

[Go]: https://golang.org/
[LICENSE]: ./LICENSE