From ba7b113206763d19c025ca64ed34c749a94fb7ad Mon Sep 17 00:00:00 2001 From: WillyPillow Date: Fri, 7 Aug 2020 02:14:37 +0800 Subject: [PATCH] qvm-template: Replace newlines in machine-readable output. --- qubesadmin/tools/qvm_template.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qubesadmin/tools/qvm_template.py b/qubesadmin/tools/qvm_template.py index 0c7f5e3..9f443a1 100644 --- a/qubesadmin/tools/qvm_template.py +++ b/qubesadmin/tools/qvm_template.py @@ -898,7 +898,7 @@ def list_templates(args: argparse.Namespace, outputs.append((status, output)) return outputs - def info_to_machine_output(tpls): + def info_to_machine_output(tpls, replace_newline=True): outputs = [] for status, grp in itertools.groupby(tpls, lambda x: x[0]): output = [] @@ -908,7 +908,8 @@ def list_templates(args: argparse.Namespace, dlsize = str(dlsize) buildtime = str(buildtime) install_time = str(install_time) if install_time else '' - # TODO: Escape newlines in description? + if replace_newline: + description = description.replace('\n', '|') output.append((name, epoch, version, release, reponame, dlsize, buildtime, install_time, licence, url, summary, description))