2 .\" # Copyright (c) 2014, Juniper Networks, Inc.
3 .\" # All rights reserved.
4 .\" # This SOFTWARE is licensed under the LICENSE provided in the
5 .\" # ../Copyright file. By downloading, installing, copying, or
6 .\" # using the SOFTWARE, you agree to be bound by the terms of that
8 .\" # Phil Shafer, July 2014
15 .Nd emit formatted output based on format string and arguments
23 utility allows command line access to the functionality of
29 shell scripts can emit
34 using the same commands that emit text output.
36 .Bl -tag -width "12345678901234567"
37 .It Fl "-close <path>"
38 Close tags for the given path
40 Set the depth for pretty printing
42 Display this help text
47 .It Fl "-leading-xpath <path>"
48 Add a prefix to generated XPaths (HTML)
50 Open tags for the given path
51 .It Fl "-pretty OR -p"
52 Make 'pretty' output (add indent, newlines)
53 .It Fl "-style <style>"
54 Generate given style (xml, json, text, html)
56 Generate text output (the default style)
58 Display version information
60 Display warnings in text on stderr
62 Display warnings in xml on stdout
64 Wrap output in a set of containers
68 Add XPath data to HTML output
73 utility accepts a format string suitable for
75 and a set of zero or more arguments used to supply data for that string.
76 .Bd -literal -offset indent
77 xo "The {k:name} weighs {:weight/%d} pounds.\\n" fish 6
80 The fish weighs 6 pounds.
89 <div class="text">The </div>
90 <div class="data" data-tag="name">fish</div>
91 <div class="text"> weighs </div>
92 <div class="data" data-tag="weight">6</div>
93 <div class="text"> pounds.</div>
99 option can be used to wrap emitted content in a
101 The path is a set of hierarchical names separated
102 by the '/' character.
103 .Bd -literal -offset indent
104 xo --wrap top/a/b/c '{:tag}' value
133 hierarchical information without the matching close and open
135 This allows a shell script to emit open tags, data, and
139 option may be used to set the
140 depth for indentation.
142 .Fl "\-leading-xpath"
144 prepend data to the XPath values used for HTML output style.
145 .Bd -literal -offset indent
148 xo --depth 2 '{tag}' value
165 % xo 'The {:product} is {:status}\n' stereo "in route"
166 The stereo is in route
167 % xo -p -X 'The {:product} is {:status}\n' stereo "in route"
168 <product>stereo</product>
169 <status>in route</status>