configurator icon indicating copy to clipboard operation
configurator copied to clipboard

Implemented "Exporting"/"Pretty printing"; is it worth integrating?

Open mstksg opened this issue 9 years ago • 2 comments

First of all, thanks for the great library.

Just letting you know that I've implemented a "configuration exporter", which uses pretty to pretty-print a valid configuration file given a Config or a HashMap Name Value:

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

It's somewhat related to #14, but is less geared towards generating files with specific comments and structures and more towards "round-trip" sort of processes that end in "dumping" actual Configs/HashMaps -- load a config, modify it (potentially) and re-export its modified version (or a modified HashMap) as a valid configuration file. Also usable for "merging" several configuration files together, or inlining interpolations/imports.

Was wondering if you thought the best path would be to integrate/pull in that library as just an extra module of functionality into configurator, or if it's best left as a side/companion package of utilities.

(It does add a dependency on pretty, and I also used semigroups's NonEmpty for writing one of the algorithms,)

mstksg avatar Jan 16 '16 10:01 mstksg

@mstksg, how would you approach saving a modified config? I see no way to produce a value of Config, other than the load* functions..

deepfire avatar Mar 20 '16 16:03 deepfire

@deepfire ah yeah, you don't really ever "modify" a Config explicitly; you can just add more and more files to its dependencies and potentially modify the contents of those files, which would auto-reload a properly loaded Config.

I suppose with configurator-export, one could also directly modify the hashmap and use the export functions to overwrite watched files, which would update the Config appropriately.

mstksg avatar Mar 21 '16 01:03 mstksg