summaryrefslogtreecommitdiffstats
path: root/inspector/virt-inspector.pod
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2011-11-03 13:06:25 +0000
committerRichard W.M. Jones <rjones@redhat.com>2011-11-03 13:06:25 +0000
commitd1ee71782ace98a11c5aabaf1f9fd5f601e08367 (patch)
tree6eec7dbfb585735cac0cab50c43ecfb8970f1e5a /inspector/virt-inspector.pod
parentffbafadcb8dfebcaba529cb8d7e2da52dd032d8a (diff)
downloadlibguestfs-d1ee71782ace98a11c5aabaf1f9fd5f601e08367.tar.gz
libguestfs-d1ee71782ace98a11c5aabaf1f9fd5f601e08367.tar.xz
libguestfs-d1ee71782ace98a11c5aabaf1f9fd5f601e08367.zip
Add virt-inspector --xpath to run XPath queries directly.
xmlstarlet is good, but not available in Red Hat Enterprise Linux. Build a simple but sane XPath query parser into virt-inspector directly so that we don't need any external tools.
Diffstat (limited to 'inspector/virt-inspector.pod')
-rwxr-xr-xinspector/virt-inspector.pod29
1 files changed, 22 insertions, 7 deletions
diff --git a/inspector/virt-inspector.pod b/inspector/virt-inspector.pod
index df9dfdad..9a43e944 100755
--- a/inspector/virt-inspector.pod
+++ b/inspector/virt-inspector.pod
@@ -132,6 +132,13 @@ Display version number and exit.
Enable tracing of libguestfs API calls.
+=item B<--xpath> query
+
+Perform an XPath query on the XML on stdin, and print the result on
+stdout. In this mode virt-inspector simply runs an XPath query; all
+other inspection functions are disabled. See L</XPATH QUERIES> below
+for some examples.
+
=back
=head1 OLD-STYLE COMMAND LINE ARGUMENTS
@@ -327,26 +334,34 @@ installer, or one part of a multipart CD. For example:
<format>installer</format>
<live/>
-=head1 USING XPATH
+=head1 XPATH QUERIES
+
+Virt-inspector includes built in support for running XPath queries.
+The reason for including XPath support directly in virt-inspector is
+simply that there are no good and widely available command line
+programs that can do XPath queries. The only good one is
+L<xmlstarlet(1)> and that is not available on Red Hat Enterprise
+Linux.
-You can use the XPath query language to select parts of the XML. We
-recommend using C<xmlstarlet> to perform XPath queries from the
-command line.
+To perform an XPath query, use the I<--xpath> option. Note that in
+this mode, virt-inspector simply reads XML from stdin and outputs the
+query result on stdout. All other inspection features are disabled in
+this mode.
For example:
- $ virt-inspector -d Guest | xmlstarlet sel -t -c '//filesystems'
+ $ virt-inspector -d Guest | virt-inspector --xpath '//filesystems'
<filesystems>
<filesystem dev="/dev/vg_f13x64/lv_root">
<type>ext4</type>
[...]
$ virt-inspector -d Guest | \
- xmlstarlet sel -t -c "string(//filesystem[@dev='/dev/sda1']/type)"
+ virt-inspector --xpath "string(//filesystem[@dev='/dev/sda1']/type)"
ext4
$ virt-inspector -d Guest | \
- xmlstarlet sel -t -v '//icon' | base64 -i -d | display -
+ virt-inspector --xpath 'string(//icon)' | base64 -i -d | display -
[displays the guest icon, if there is one]
=head1 SHELL QUOTING