libucl comes with a Lua library binding. Build it into flua.
This lets us parse/generate config files in the various formats supported by libucl with flua.
Details
Details
- Reviewers
emaste kevans pstef mmacy - Commits
- rS362477: flua: add ucl library
local ucl = require('ucl') local parser = ucl.parser() local res, err = parser:parse_string(io.read('*a')) if not res then print('parser error: ' .. err) return 1 end local obj = parser:get_object() print(ucl.to_format(obj, 'config')) print(ucl.to_format(obj, 'json')) print(ucl.to_format(obj, 'json-compact')) print(ucl.to_format(obj, 'yaml'))
/usr/libexec/flua test.lua </etc/rc.conf
Diff Detail
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
Just FYI I'm planning to add module loading support to flua soon, although the current plan is not to have it enabled under BOOTSTRAPPING.
Comment Actions
This will need a little bit of ^/Makefile.inc1 work to make sure libucl is built for bootstrap flua:
<incorrect statements>
- _prebuild_libs should have a ${_lib_libucl} added to it
- Define _lib_libucl where _flua is defined, so that we prebuild libucl only if we're building bootstrap flua
- Make sure libucl depends on msun properly with the proper libname__L line, as can be seen later with libdialog; this would also go in the BOOTSTRAPPING block
</incorrect statements>
- Add libucl to _flua and make sure it's on the dependency line above it as well
Off the top of my head, I think that's it. You can bump the BOOTSTRAPPING version to later than your running system to test bootstrap flua, which we may want to do anyways to make sure we've got a flua with libucl if I rewrite generate-ucl.sh with it.
Comment Actions
Add libucl to bootstrap.
When something actually uses it we can bump the BOOTSTRAPPING version in Makefile.inc1.