configurator-export

Pretty printer and exporter for configurations from the "configurator" library.

http://github.com/mstksg/configurator-export

Version on this page:0.1.0.0
LTS Haskell 22.14:0.1.0.1
Stackage Nightly 2024-03-28:0.1.0.1
Latest on Hackage:0.1.0.1

See all snapshots configurator-export appears in

BSD-3-Clause licensed by Justin Le
Maintained by [email protected]
This version can be pinned in stack with:configurator-export-0.1.0.0@sha256:ad6d0ac555b0f6d1851895a7803fcc22dba5395a3b94ddf3e9d3e850d44c9a86,2485

Module documentation for 0.1.0.0

configurator-export

Pretty printers and exporters for ‘Config’s from the great configurator library.

All results are intended to be valid parsing files in the configuration file syntax of the library.

For a full round trip:

main = do
  cfg <- load [Required "config.cfg"]
  writeConf "config.cfg" cfg

This should load the config file, parse it, and then re-export it, rewriting the original config file. The result should be an identical configuration file (with keys potentially re-arranged and re-sorted, comments removed, etc.)

Can also export/print any HashMap Name Value, in the form exported from a Config using getMap. Modify a map yourself to dynically generate/customize configuration files!

Sample output:

foo {
    bar {
        baz1  = true
        baz2  = [1, 0.6, "hello", true]
    }
    aardvark  = "banana"
    monkey    = [true, false, 1.9e-3]
    zebra     = 24
}

foo2 {
    bar = 8.1e-8
}

apple   = ["cake", true]
orange  = 8943

Further configuration on sorting of keys, displaying of bools and floats, etc. is possible by passing in custom ConfStyle style option values.

Changes