Skip to content

Commit

Permalink
Improve new qvm-ls documentation & comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alimirjamali committed Aug 8, 2024
1 parent 54736f2 commit 615baf2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
20 changes: 10 additions & 10 deletions doc/manpages/qvm-ls.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. program:: qvm-ls

:program:`qvm-ls` -- List VMs and various information about them
:program:`qvm-ls` -- List qubes and various information about them
================================================================

Synopsis
Expand Down Expand Up @@ -77,7 +77,7 @@ Formatting options

.. option:: --tree, -t

List domains as a network tree. Domains are sorted as they are connected to
List qubes as a network tree. Qubes are sorted as they are connected to
their netvms. Names are indented relative to the number of connected netvms.

.. option:: --raw-data
Expand Down Expand Up @@ -123,16 +123,16 @@ Filtering options

.. option:: --tags TAG ...

Shows only VMs having specific tag(s).
Shows only qubes having specific tag(s).

.. option:: --exclude-tags TAG ...

Exclude VMs having specific tag(s).
Exclude qubes having specific tag(s).

.. option:: --running, --paused, --halted

Shows only VMs matching the specified power state(s). When none of these
options is used (default), all VMs are shown.
Shows only qubes matching the specified power state(s). When none of these
options is used (default), all qubes are shown.

.. option:: --template-source TEMPLATE ...

Expand All @@ -157,19 +157,19 @@ Filtering options
.. option:: --features FEATURE=VALUE ...

Filter results to qubes that match all specified features. Omitted VALUE
means None (not set). "" or '' means blank
means None (unset). Empty value means "" or '' (blank)

.. option:: --prefs PREFERENCE=VALUE ...

Filter results to qubes that match all specified preferences. Omitted VALUE
means None (not set). "" or '' means blank
means None (unset). Empty value means "" or '' (blank)

Sorting options
---------------

.. option:: --sort COLUMN

Sort based on provided column rather than NAME. Sort key should be in the
Sort based on provided column rather than NAME. Sort key must be in the
output columns

.. option:: --reverse
Expand All @@ -178,7 +178,7 @@ Sorting options

.. option:: --ignore-case

Ignore case distinctions for sorting
Ignore case distinctions when sorting

Authors
-------
Expand Down
24 changes: 12 additions & 12 deletions qubesadmin/tools/qvm_ls.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,20 +699,20 @@ def get_parser():

parser_filter.add_argument('--servicevm', metavar='<y|n>',
default='both', action='store', choices=['y', 'yes', 'n', 'no'],
help='show only Service VMs or option to hide them')
help='show only ServiceVMs or option to hide them')

parser_filter.add_argument('--pending-update', action='store_true',
help='filter results to qubes pending for update')

parser_filter.add_argument('--features', nargs='+', metavar='FEATURE=VALUE',
action='store',
help='filter results to qubes that matches all specified features. '
'omitted VALUE means None. "" means blank')
'omitted VALUE means None (unset). Empty value means "" (blank)')

parser_filter.add_argument('--prefs', nargs='+', metavar='PREFERENCE=VALUE',
action='store',
help='filter results to qubes that matches all specified preferences. '
'omitted VALUE means None. "" means blank')
'omitted VALUE means None (unset). Empty value means "" (blank)')

parser_sort = parser.add_argument_group(title='sorting options')

Expand All @@ -723,7 +723,7 @@ def get_parser():
help='reverse sort')

parser_sort.add_argument('--ignore-case', action='store_true',
default=False, help='ignore case distinctions for sorting')
default=False, help='ignore case distinctions when sorting')

parser.add_argument('--spinner',
action='store_true', dest='spinner',
Expand Down Expand Up @@ -796,11 +796,11 @@ def main(args=None, app=None):
]

if args.klass:
# filter only VMs to specific class(es)
# filter only qubes to specific class(es)
domains = [d for d in domains if d.klass in args.klass]

if args.label:
# filter only VMs with specific label(s)
# filter only qubes with specific label(s)
domains_labeled = []
spinner.show('Filtering based on labels...')
for dom in domains:
Expand All @@ -811,17 +811,17 @@ def main(args=None, app=None):
spinner.hide()

if args.tags:
# filter only VMs having at least one of the specified tags
# filter only qubes having at least one of the specified tags
domains = [dom for dom in domains
if set(dom.tags).intersection(set(args.tags))]

if args.exclude_tags:
# exclude VMs having at least one of the specified tags
# exclude qubes having at least one of the specified tags
domains = [dom for dom in domains
if not set(dom.tags).intersection(set(args.exclude_tags))]

if args.template_source:
# Filter only VMs based on specific TemplateVM
# Filter only qubes based on specific TemplateVM
domains_template = []
spinner.show('Filtering results to qubes based on their templates...')
for dom in domains:
Expand All @@ -832,7 +832,7 @@ def main(args=None, app=None):
spinner.hide()

if args.netvm_is:
# Filter only VMs connecting with specific netvm
# Filter only qubes connecting with specific netvm
domains_netvm = []
spinner.show('Filtering results to qubes based on their netvm...')
for dom in domains:
Expand Down Expand Up @@ -861,7 +861,7 @@ def main(args=None, app=None):
d.features.get('updates-available', None)]

if args.features:
# Filter only VMs with specified features
# Filter only qubes with specified features
for feature in args.features:
try:
key, value = feature.split('=', 1)
Expand All @@ -876,7 +876,7 @@ def main(args=None, app=None):
domains = [d for d in domains if d.features.get(key, None) == value]

if args.prefs:
# Filter only VMs with specified preferences
# Filter only qubes with specified preferences
for pref in args.prefs:
try:
key, value = pref.split('=', 1)
Expand Down

0 comments on commit 615baf2

Please sign in to comment.