From 5375dce90db5e494b1c85fc3fd9f310cad3e42e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 11 Feb 2016 02:52:06 +0100 Subject: [PATCH] Prefer human readable output in qvm-prefs and qubes-prefs tools --- qubes/__init__.py | 2 ++ qubes/tools/qubes_prefs.py | 4 ++-- qubes/tools/qvm_prefs.py | 4 ++-- qubes/vm/qubesvm.py | 3 +++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/qubes/__init__.py b/qubes/__init__.py index bb455530..aeb0bd52 100644 --- a/qubes/__init__.py +++ b/qubes/__init__.py @@ -335,6 +335,8 @@ class Label(object): element.text = self.name return element + def __str__(self): + return self.name def __repr__(self): return '{}({!r}, {!r}, {!r})'.format( diff --git a/qubes/tools/qubes_prefs.py b/qubes/tools/qubes_prefs.py index 7228ba58..12a644f4 100644 --- a/qubes/tools/qubes_prefs.py +++ b/qubes/tools/qubes_prefs.py @@ -72,10 +72,10 @@ def main(args=None): continue if args.app.property_is_default(prop): - print('{name:{width}s} D {value!r}'.format( + print('{name:{width}s} D {value!s}'.format( name=prop.__name__, width=width, value=value)) else: - print('{name:{width}s} - {value!r}'.format( + print('{name:{width}s} - {value!s}'.format( name=prop.__name__, width=width, value=value)) return 0 diff --git a/qubes/tools/qvm_prefs.py b/qubes/tools/qvm_prefs.py index e1e9255f..336b319a 100644 --- a/qubes/tools/qvm_prefs.py +++ b/qubes/tools/qvm_prefs.py @@ -75,10 +75,10 @@ def main(args=None): continue if args.vm.property_is_default(prop): - print('{name:{width}s} D {value!r}'.format( + print('{name:{width}s} D {value!s}'.format( name=prop.__name__, width=width, value=value)) else: - print('{name:{width}s} - {value!r}'.format( + print('{name:{width}s} - {value!s}'.format( name=prop.__name__, width=width, value=value)) return 0 diff --git a/qubes/vm/qubesvm.py b/qubes/vm/qubesvm.py index 3f97deeb..1d44a800 100644 --- a/qubes/vm/qubesvm.py +++ b/qubes/vm/qubesvm.py @@ -290,6 +290,9 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM): # properties not loaded from XML, calculated at run-time # + def __str__(self): + return self.name + # VMM-related @qubes.tools.qvm_ls.column(width=3)