XML Output: libxo - provide single API to output TXT, XML, JSON and HTML

Simon J. Gerraty sjg at juniper.net
Thu Aug 14 17:17:16 UTC 2014


>My question for people advocating this method: Why not require all =
>commands
>that generate this kind of output to support a standard command line =
>option

That's basically what we did in Junos, except the -X option currently
just means output XML.
That worked fine for the limited number of bsd apps that we frobbed,
but pretty hard to assert that it could be expanded to all apps.

Thus I think Phil was looking for a more generic solution.

I think your suggestion could work fine.
Since (I think) Phil mentioned libxo being able to check options,
it should be ok to run an app with an option like:

--libxo-is-supported

that's guaranteed to not conflict with any existing option.
Any app that hasn't been converted will choke and die, any that has will 
exit happy.

You could add other --libxo-* options to control output - if environment
variables are not considered desirable


More information about the freebsd-arch mailing list