From owner-svn-src-vendor@freebsd.org Tue Sep 3 14:06:09 2019 Return-Path: Delivered-To: svn-src-vendor@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 16A6CDC432; Tue, 3 Sep 2019 14:06:09 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46N7z372Pxz4PDm; Tue, 3 Sep 2019 14:06:07 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1452) id 29C221A1AB; Tue, 3 Sep 2019 14:05:59 +0000 (UTC) X-Original-To: yuripv@localmail.freebsd.org Delivered-To: yuripv@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id 182275FCC; Wed, 3 Apr 2019 21:47:25 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3FA176F06D; Wed, 3 Apr 2019 21:47:24 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 538) id 112F75FA5; Wed, 3 Apr 2019 21:47:24 +0000 (UTC) Delivered-To: src-committers@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id B79645F98 for ; Wed, 3 Apr 2019 21:47:21 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7849C6F05D; Wed, 3 Apr 2019 21:47:21 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 53D401BF46; Wed, 3 Apr 2019 21:47:21 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x33LlLFo008092; Wed, 3 Apr 2019 21:47:21 GMT (envelope-from phil@FreeBSD.org) Received: (from phil@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x33LlJmV008084; Wed, 3 Apr 2019 21:47:19 GMT (envelope-from phil@FreeBSD.org) Message-Id: <201904032147.x33LlJmV008084@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phil set sender to phil@FreeBSD.org using -f From: Phil Shafer To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r345856 - in vendor/Juniper/libxo/dist: . doc libxo tests/core tests/core/saved tests/gettext tests/gettext/po/pig_latin tests/gettext/saved tests/xo tests/xo/saved xo X-SVN-Group: vendor X-SVN-Commit-Author: phil X-SVN-Commit-Paths: in vendor/Juniper/libxo/dist: . doc libxo tests/core tests/core/saved tests/gettext tests/gettext/po/pig_latin tests/gettext/saved tests/xo tests/xo/saved xo X-SVN-Commit-Revision: 345856 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk X-Loop: FreeBSD.org Sender: owner-src-committers@freebsd.org X-Rspamd-Queue-Id: 3FA176F06D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.99 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.99)[-0.989,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Status: O X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.29 List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Tue, 03 Sep 2019 14:06:09 -0000 X-Original-Date: Wed, 3 Apr 2019 21:47:19 +0000 (UTC) X-List-Received-Date: Tue, 03 Sep 2019 14:06:09 -0000 Author: phil Date: Wed Apr 3 21:47:19 2019 New Revision: 345856 URL: https://svnweb.freebsd.org/changeset/base/345856 Log: Import libxo 1.0.2 Added: vendor/Juniper/libxo/dist/libxo/xo_explicit.h (contents, props changed) vendor/Juniper/libxo/dist/tests/xo/saved/xo_02.H.err vendor/Juniper/libxo/dist/tests/xo/saved/xo_02.H.out vendor/Juniper/libxo/dist/tests/xo/saved/xo_02.HIPx.err vendor/Juniper/libxo/dist/tests/xo/saved/xo_02.HIPx.out vendor/Juniper/libxo/dist/tests/xo/saved/xo_02.HP.err vendor/Juniper/libxo/dist/tests/xo/saved/xo_02.HP.out vendor/Juniper/libxo/dist/tests/xo/saved/xo_02.J.err vendor/Juniper/libxo/dist/tests/xo/saved/xo_02.J.out vendor/Juniper/libxo/dist/tests/xo/saved/xo_02.JP.err vendor/Juniper/libxo/dist/tests/xo/saved/xo_02.JP.out vendor/Juniper/libxo/dist/tests/xo/saved/xo_02.T.err vendor/Juniper/libxo/dist/tests/xo/saved/xo_02.T.out vendor/Juniper/libxo/dist/tests/xo/saved/xo_02.X.err vendor/Juniper/libxo/dist/tests/xo/saved/xo_02.X.out vendor/Juniper/libxo/dist/tests/xo/saved/xo_02.XP.err vendor/Juniper/libxo/dist/tests/xo/saved/xo_02.XP.out vendor/Juniper/libxo/dist/tests/xo/xo_02.sh (contents, props changed) Modified: vendor/Juniper/libxo/dist/configure.ac vendor/Juniper/libxo/dist/doc/api.rst vendor/Juniper/libxo/dist/doc/libxo-manual.html vendor/Juniper/libxo/dist/doc/xo.rst vendor/Juniper/libxo/dist/libxo/Makefile.am vendor/Juniper/libxo/dist/libxo/libxo.c vendor/Juniper/libxo/dist/libxo/xo.h vendor/Juniper/libxo/dist/libxo/xo_attr.3 vendor/Juniper/libxo/dist/libxo/xo_buf.h vendor/Juniper/libxo/dist/libxo/xo_emit.3 vendor/Juniper/libxo/dist/libxo/xo_emit_f.3 vendor/Juniper/libxo/dist/libxo/xo_finish.3 vendor/Juniper/libxo/dist/libxo/xo_flush.3 vendor/Juniper/libxo/dist/libxo/xo_open_container.3 vendor/Juniper/libxo/dist/libxo/xo_open_list.3 vendor/Juniper/libxo/dist/libxo/xo_open_marker.3 vendor/Juniper/libxo/dist/libxo/xo_set_writer.3 vendor/Juniper/libxo/dist/tests/core/saved/test_01.J.out vendor/Juniper/libxo/dist/tests/core/saved/test_02.J.out vendor/Juniper/libxo/dist/tests/core/saved/test_03.J.out vendor/Juniper/libxo/dist/tests/core/saved/test_04.J.out vendor/Juniper/libxo/dist/tests/core/saved/test_05.J.out vendor/Juniper/libxo/dist/tests/core/saved/test_05.JP.out vendor/Juniper/libxo/dist/tests/core/saved/test_06.J.out vendor/Juniper/libxo/dist/tests/core/saved/test_07.J.out vendor/Juniper/libxo/dist/tests/core/saved/test_08.J.out vendor/Juniper/libxo/dist/tests/core/saved/test_09.J.out vendor/Juniper/libxo/dist/tests/core/saved/test_10.J.out vendor/Juniper/libxo/dist/tests/core/saved/test_11.J.out vendor/Juniper/libxo/dist/tests/core/saved/test_12.E.err vendor/Juniper/libxo/dist/tests/core/saved/test_12.E.out vendor/Juniper/libxo/dist/tests/core/saved/test_12.H.err vendor/Juniper/libxo/dist/tests/core/saved/test_12.H.out vendor/Juniper/libxo/dist/tests/core/saved/test_12.HIPx.err vendor/Juniper/libxo/dist/tests/core/saved/test_12.HIPx.out vendor/Juniper/libxo/dist/tests/core/saved/test_12.HP.err vendor/Juniper/libxo/dist/tests/core/saved/test_12.HP.out vendor/Juniper/libxo/dist/tests/core/saved/test_12.J.err vendor/Juniper/libxo/dist/tests/core/saved/test_12.J.out vendor/Juniper/libxo/dist/tests/core/saved/test_12.JP.err vendor/Juniper/libxo/dist/tests/core/saved/test_12.JP.out vendor/Juniper/libxo/dist/tests/core/saved/test_12.T.err vendor/Juniper/libxo/dist/tests/core/saved/test_12.T.out vendor/Juniper/libxo/dist/tests/core/saved/test_12.X.err vendor/Juniper/libxo/dist/tests/core/saved/test_12.X.out vendor/Juniper/libxo/dist/tests/core/saved/test_12.XP.err vendor/Juniper/libxo/dist/tests/core/saved/test_12.XP.out vendor/Juniper/libxo/dist/tests/core/test_12.c vendor/Juniper/libxo/dist/tests/gettext/po/pig_latin/strerror.po vendor/Juniper/libxo/dist/tests/gettext/saved/gt_01.J.out vendor/Juniper/libxo/dist/tests/gettext/strerror.pot vendor/Juniper/libxo/dist/tests/xo/Makefile.am vendor/Juniper/libxo/dist/tests/xo/saved/xo_01.H.out vendor/Juniper/libxo/dist/tests/xo/saved/xo_01.HIPx.out vendor/Juniper/libxo/dist/tests/xo/saved/xo_01.HP.out vendor/Juniper/libxo/dist/tests/xo/saved/xo_01.J.out vendor/Juniper/libxo/dist/tests/xo/saved/xo_01.JP.out vendor/Juniper/libxo/dist/tests/xo/saved/xo_01.T.out vendor/Juniper/libxo/dist/tests/xo/xo_01.sh vendor/Juniper/libxo/dist/xo/xo.1 vendor/Juniper/libxo/dist/xo/xo.c Modified: vendor/Juniper/libxo/dist/configure.ac ============================================================================== --- vendor/Juniper/libxo/dist/configure.ac Wed Apr 3 21:01:53 2019 (r345855) +++ vendor/Juniper/libxo/dist/configure.ac Wed Apr 3 21:47:19 2019 (r345856) @@ -12,7 +12,7 @@ # AC_PREREQ(2.2) -AC_INIT([libxo], [0.9.0], [phil@juniper.net]) +AC_INIT([libxo], [1.0.2], [phil@juniper.net]) AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability]) # Support silent build rules. Requires at least automake-1.11. Modified: vendor/Juniper/libxo/dist/doc/api.rst ============================================================================== --- vendor/Juniper/libxo/dist/doc/api.rst Wed Apr 3 21:01:53 2019 (r345855) +++ vendor/Juniper/libxo/dist/doc/api.rst Wed Apr 3 21:47:19 2019 (r345856) @@ -400,28 +400,28 @@ string, since an inappropriate cast can ruin your day. argument to `xo_emit_hv` points to a variable argument list that can be used to retrieve arguments via `va_arg`. -.. c:function:: int xo_emit (const char *fmt, ...) +.. c:function:: xo_ssize_t xo_emit (const char *fmt, ...) :param fmt: The format string, followed by zero or more arguments :returns: If XOF_COLUMNS is set, the number of columns used; otherwise the number of bytes emitted - :rtype: int + :rtype: xo_ssize_t -.. c:function:: int xo_emit_h (xo_handle_t *xop, const char *fmt, ...) +.. c:function:: xo_ssize_t xo_emit_h (xo_handle_t *xop, const char *fmt, ...) :param xop: Handle for modify (or NULL for default handle) :type xop: xo_handle_t \* :param fmt: The format string, followed by zero or more arguments :returns: If XOF_COLUMNS is set, the number of columns used; otherwise the number of bytes emitted - :rtype: int + :rtype: xo_ssize_t -.. c:function:: int xo_emit_hv (xo_handle_t *xop, const char *fmt, va_list vap) +.. c:function:: xo_ssize_t xo_emit_hv (xo_handle_t *xop, const char *fmt, va_list vap) :param xop: Handle for modify (or NULL for default handle) :type xop: xo_handle_t \* :param fmt: The format string :param va_list vap: A set of variadic arguments :returns: If XOF_COLUMNS is set, the number of columns used; otherwise the number of bytes emitted - :rtype: int + :rtype: xo_ssize_t .. index:: xo_emit_field @@ -434,7 +434,7 @@ scenario where one would otherwise need to compose a f descriptors using `snprintf`. The individual parts of the format descriptor are passed in distinctly. -.. c:function:: int xo_emit_field (const char *rolmod, const char *contents, const char *fmt, const char *efmt, ...) +.. c:function:: xo_ssize_t xo_emit_field (const char *rolmod, const char *contents, const char *fmt, const char *efmt, ...) :param rolmod: A comma-separated list of field roles and field modifiers :type rolmod: const char * @@ -445,7 +445,7 @@ descriptor are passed in distinctly. :param efmt: Encoding format string, followed by additional arguments :type efmt: const char * :returns: If XOF_COLUMNS is set, the number of columns used; otherwise the number of bytes emitted - :rtype: int + :rtype: xo_ssize_t :: @@ -453,7 +453,7 @@ descriptor are passed in distinctly. xo_emit_field("T", "Host name is ", NULL, NULL); xo_emit_field("V", "host-name", NULL, NULL, host-name); -.. c:function:: int xo_emit_field_h (xo_handle_t *xop, const char *rolmod, const char *contents, const char *fmt, const char *efmt, ...) +.. c:function:: xo_ssize_t xo_emit_field_h (xo_handle_t *xop, const char *rolmod, const char *contents, const char *fmt, const char *efmt, ...) :param xop: Handle for modify (or NULL for default handle) :type xop: xo_handle_t \* @@ -466,9 +466,9 @@ descriptor are passed in distinctly. :param efmt: Encoding format string, followed by additional arguments :type efmt: const char * :returns: If XOF_COLUMNS is set, the number of columns used; otherwise the number of bytes emitted - :rtype: int + :rtype: xo_ssize_t -.. c:function:: int xo_emit_field_hv (xo_handle_t *xop, const char *rolmod, const char *contents, const char *fmt, const char *efmt, va_list vap) +.. c:function:: xo_ssize_t xo_emit_field_hv (xo_handle_t *xop, const char *rolmod, const char *contents, const char *fmt, const char *efmt, va_list vap) :param xop: Handle for modify (or NULL for default handle) :type xop: xo_handle_t \* @@ -482,7 +482,7 @@ descriptor are passed in distinctly. :type efmt: const char * :param va_list vap: A set of variadic arguments :returns: If XOF_COLUMNS is set, the number of columns used; otherwise the number of bytes emitted - :rtype: int + :rtype: xo_ssize_t .. index:: xo_attr .. _xo_attr: @@ -505,14 +505,14 @@ Since attributes are only emitted in XML, their use sh to meta-data and additional or redundant representations of data already emitted in other form. -.. c:function:: int xo_attr (const char *name, const char *fmt, ...) +.. c:function:: xo_ssize_t xo_attr (const char *name, const char *fmt, ...) :param name: Attribute name :type name: const char * :param fmt: Attribute value, as variadic arguments :type fmt: const char * :returns: -1 for error, or the number of bytes in the formatted attribute value - :rtype: int + :rtype: xo_ssize_t :: @@ -525,7 +525,7 @@ already emitted in other form. 00:14 -.. c:function:: int xo_attr_h (xo_handle_t *xop, const char *name, const char *fmt, ...) +.. c:function:: xo_ssize_t xo_attr_h (xo_handle_t *xop, const char *name, const char *fmt, ...) :param xop: Handle for modify (or NULL for default handle) :type xop: xo_handle_t \* @@ -533,7 +533,7 @@ already emitted in other form. The `xo_attr_h` function follows the conventions of `xo_attr` but adds an explicit libxo handle. -.. c:function:: int xo_attr_hv (xo_handle_t *xop, const char *name, const char *fmt, va_list vap) +.. c:function:: xo_ssize_t xo_attr_hv (xo_handle_t *xop, const char *name, const char *fmt, va_list vap) The `xo_attr_h` function follows the conventions of `xo_attr_h` but replaced the variadic list with a variadic pointer. Modified: vendor/Juniper/libxo/dist/doc/libxo-manual.html ============================================================================== --- vendor/Juniper/libxo/dist/doc/libxo-manual.html Wed Apr 3 21:01:53 2019 (r345855) +++ vendor/Juniper/libxo/dist/doc/libxo-manual.html Wed Apr 3 21:47:19 2019 (r345856) @@ -515,7 +515,7 @@ li.indline1 { } @top-right { - content: "May 2018"; + content: "April 2019"; } @top-center { @@ -22011,7 +22011,7 @@ jQuery(function ($) { -May 21, 2018 +April 2, 2019

libxo: The Easy Way to Generate text, XML, JSON, and HTML output
libxo-manual

Modified: vendor/Juniper/libxo/dist/doc/xo.rst ============================================================================== --- vendor/Juniper/libxo/dist/doc/xo.rst Wed Apr 3 21:01:53 2019 (r345855) +++ vendor/Juniper/libxo/dist/doc/xo.rst Wed Apr 3 21:47:19 2019 (r345856) @@ -75,7 +75,7 @@ prepend data to the XPath values used for HTML output EXAMPLE; #!/bin/sh xo --open top/data - xo --depth 2 '{tag}' value + xo --depth 2 '{:tag}' value xo --close top/data XML: @@ -90,6 +90,84 @@ prepend data to the XPath values used for HTML output } } +When making partial lines of output (where the format string does not +include a newline), use the `--continuation` option to let secondary +invocations know they are adding data to an existing line. + +When emitting a series of objects, use the `--not-first` option to +ensure that any details from the previous object (e.g. commas in JSON) +are handled correctly. + +Use the `--top-wrap` option to ensure any top-level object details are +handled correctly, e.g. wrap the entire output in a top-level set of +braces for JSON output. + + EXAMPLE; + #!/bin/sh + xo --top-wrap --open top/data + xo --depth 2 'First {:tag} ' value1 + xo --depth 2 --continuation 'and then {:tag}\n' value2 + xo --top-wrap --close top/data + TEXT: + First value1 and then value2 + HTML: +
+
First
+
value1
+
+
and then
+
value2
+
+ XML: + + + value1 + value2 + + + JSON: + { + "top": { + "data": { + "tag": "value1", + "tag": "value2" + } + } + } + +Lists and Instances +------------------- + +A "*list*" is set of one or more instances that appear under the same +parent. The instances contain details about a specific object. One +can think of instances as objects or records. A call is needed to +open and close the list, while a distinct call is needed to open and +close each instance of the list. + +Use the `--open-list` and `--open-instances` to open lists and +instances. Use the `--close-list` and `--close-instances` to close +them. Each of these options take a `name` parameter, providing the +name of the list and instance. + +In the following example, a list named "machine" is created with three +instances: + + opts="--json" + xo $opts --open-list machine + NF= + for name in red green blue; do + xo $opts --depth 1 $NF --open-instance machine + xo $opts --depth 2 "Machine {k:name} has {:memory}\n" $name 55 + xo $opts --depth 1 --close-instance machine + NF=--not-first + done + xo $opts $NF --close-list machine + +The normal `libxo` functions use a state machine to help these +transitions, but since each `xo` command is invoked independent of the +previous calls, the state must be passed in explicitly via these +command line options. + Command Line Options -------------------- @@ -97,15 +175,23 @@ Command Line Options Usage: xo [options] format [fields] --close Close tags for the given path + --close-instance Close an open instance name + --close-list Close an open list name + --continuation OR -C Output belongs on same line as previous output --depth Set the depth for pretty printing --help Display this help text --html OR -H Generate HTML output --json OR -J Generate JSON output --leading-xpath Add a prefix to generated XPaths (HTML) + --not-first Indicate this object is not the first (JSON) --open Open tags for the given path + --open-instance Open an instance given by name + --open-list Open a list given by name + --option -or -O Give formatting options --pretty OR -p Make 'pretty' output (add indent, newlines) --style