Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Apr 2013 09:44:08 +0200
From:      Erik Cederstrand <erik@cederstrand.it>
To:        Alfred Perlstein <bright@mu.org>
Cc:        arch@FreeBSD.org, Gleb Smirnoff <glebius@FreeBSD.org>
Subject:   Re: [CFR][CFT] counter(9): new API for faster and raceless counters
Message-ID:  <D3A7ED36-A92F-4F9B-917A-F223D955CC43@cederstrand.it>
In-Reply-To: <515DFF05.10206@mu.org>
References:  <20130401115128.GZ76816@FreeBSD.org> <20130402232606.GC1810@garage.freebsd.pl> <20130403002523.GA96431@in-addr.com> <20130404090851.GA1335@garage.freebsd.pl> <515DFF05.10206@mu.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Den 05/04/2013 kl. 00.30 skrev Alfred Perlstein <bright@mu.org>:

> On 4/4/13 2:08 AM, Pawel Jakub Dawidek wrote:
>> XML is no go for me, as it is not really easy to use in scripts.
>> We would need to create a tool to parse it and then I'd much prefer =
to
>> import my API for dealing with name/value pairs that could be used in =
so
>> many more places.
>>=20
> Do you have a link to this format?
>=20
> I'm looking at YAML and it's interesting, although I'm not sure if a =
more abbreviated format wouldn't be better.
>=20
> What I'm currently using is like:
>=20
> date|vfs.freebuffers:5000|vfs.highbuffers: 343433|...|

If you want to implement of machine-parseable output of sysctl that =
supports key-value output, then please use a generally-accepted format. =
This would make it so much easier for third-party software to use the =
output. YAML or JSON are obvious choices.

Powershell from Microsoft solves this generally by having all tools pipe =
output as objects with a well-defined contract to the next command. =
Whatever is printed to stdout is just human-friendly output. It's nice =
because you can skip a lot of grep/sed/awk/cut trickery and just filter =
and pick fields in a more object-oriented way. But it's also a PITA =
because what's printed to the terminal is not what's piped to the next =
command, so you need to look up the object spec every time you add a =
pipe.

I think it would be going overboard to add a --yaml or --json flag to =
every single userland tool in FreeBSD, but designing key-value output =
for sysctl so it can be applied to other tools would be really nice.

Thanks,
Erik



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D3A7ED36-A92F-4F9B-917A-F223D955CC43>