Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Jul 2014 12:41:03 -0400
From:      "Garance A Drosehn" <drosih@rpi.edu>
To:        "Phil Shafer" <phil@juniper.net>
Cc:        arch@freebsd.org, marcel@freebsd.org, "Simon J. Gerraty" <sjg@juniper.net>
Subject:   Re: XML Output: libxo - provide single API to output TXT, XML, JSON and HTML
Message-ID:  <08B4AE10-1747-4BB1-AA1A-BA4491A57F95@rpi.edu>
In-Reply-To: <201407310918.s6V9IRj5092988@idle.juniper.net>
References:  <201407310918.s6V9IRj5092988@idle.juniper.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On 31 Jul 2014, at 5:18, Phil Shafer wrote:

> "Simon J. Gerraty" writes:
>> w(1) sizes those strings based on its expectation of the width of the
>> tty.  That can obviously be fixed/improved - but involves exposing
>> knowledge of the out format (or at least that it isn't TXT) to the
>> application.
>
> libxo allows the field description to carry two distinct format
> descriptors, one for text/html and one for xml/json.  The latter
> defaults to the former:
>
>  xo_emit(" {:words/%7ju/%ju}", twordct);
>
> For "w", this is does the right thing; in text mode, the command
> string is truncated:

Ah, that's helpful.

What if there's something you want to print out for xml/json but
*not* for plain-text?  (it's easy to imagine some commands might
print out more values when they are not constrained by an 80-char
width).

Also, given that machine-readable outputs might change over time,
is there the idea of including a version-number with the output
for each command?

I hope it doesn't seem like I'm just complaining about the work
everyone else is doing (both this and the GSOC project).  Please
note that I've attempted to do this a few times myself, and I haven't
been happy with any of *my* attempts either!

-- 
Garance Alistair Drosehn                =     drosih@rpi.edu
Senior Systems Programmer               or   gad@FreeBSD.org
Rensselaer Polytechnic Institute;             Troy, NY;  USA



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?08B4AE10-1747-4BB1-AA1A-BA4491A57F95>