From 6ddf1413762f92c7a742f3db5a83b96d02db5fd4 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Ouellet Date: Sun, 27 Nov 2016 01:12:53 -0500 Subject: [PATCH] Implement qvm-ls --list-fields --- doc/qvm-tools/qvm-ls.rst | 2 ++ qvm-tools/qvm-ls | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/doc/qvm-tools/qvm-ls.rst b/doc/qvm-tools/qvm-ls.rst index 9867dd1d..f359ffc8 100644 --- a/doc/qvm-tools/qvm-ls.rst +++ b/doc/qvm-tools/qvm-ls.rst @@ -34,6 +34,8 @@ OPTIONS List only VM names one per line --raw-data Display specify data of specified VMs. Intended for bash-parsing. +--list-fields + List field names valid for --raw-data AUTHORS ======= diff --git a/qvm-tools/qvm-ls b/qvm-tools/qvm-ls index ce8e8609..824e0665 100755 --- a/qvm-tools/qvm-ls +++ b/qvm-tools/qvm-ls @@ -134,9 +134,17 @@ def main(): help="Display specify data of specified VMs.\ Intended for bash-parsing.") + parser.add_argument("--list-fields", dest="list_fields", + action="store_true", default=False, + help="List field names valid for --raw-data") + arguments = parser.parse_args () + if arguments.list_fields: + print '\n'.join(sorted(fields.keys())) + return + qvm_collection = QubesVmCollection() qvm_collection.lock_db_for_reading() qvm_collection.load()