Blame SOURCES/0019-JSON-output-clean-up-list-object.patch

a436c4
From 2b1c730b493d647bbab4854713571458e82a81e7 Mon Sep 17 00:00:00 2001
a436c4
From: Lyonel Vincent <lyonel@ezix.org>
a436c4
Date: Tue, 26 May 2020 01:00:37 +0200
a436c4
Subject: [PATCH 19/65] JSON output clean-up (list/object)
a436c4
a436c4
---
a436c4
 src/core/hw.cc | 5 ++---
a436c4
 src/lshw.cc    | 1 +
a436c4
 2 files changed, 3 insertions(+), 3 deletions(-)
a436c4
a436c4
diff --git a/src/core/hw.cc b/src/core/hw.cc
a436c4
index aca424c..ab345fe 100644
a436c4
--- a/src/core/hw.cc
a436c4
+++ b/src/core/hw.cc
a436c4
@@ -1400,7 +1400,7 @@ string hwNode::asJSON(unsigned level)
a436c4
   config = getConfigKeys();
a436c4
   resources = getResources("\" value=\"");
a436c4
 
a436c4
-  if (level == 0)
a436c4
+  if (::enabled("output:list") && level == 0)
a436c4
   {
a436c4
     out << "[" << endl;
a436c4
   }
a436c4
@@ -1665,9 +1665,8 @@ string hwNode::asJSON(unsigned level)
a436c4
     out << "}";
a436c4
   }
a436c4
 
a436c4
-  if (level == 0)
a436c4
+  if (::enabled("output:list") && level == 0)
a436c4
   {
a436c4
-    out.seekp(-2, std::ios_base::end);
a436c4
     out << endl << "]" << endl;
a436c4
   }
a436c4
 
a436c4
diff --git a/src/lshw.cc b/src/lshw.cc
a436c4
index 219a008..571b1c3 100644
a436c4
--- a/src/lshw.cc
a436c4
+++ b/src/lshw.cc
a436c4
@@ -84,6 +84,7 @@ char **argv)
a436c4
 
a436c4
   disable("isapnp");
a436c4
 
a436c4
+  disable("output:list");
a436c4
   disable("output:json");
a436c4
   disable("output:db");
a436c4
   disable("output:xml");
a436c4
-- 
a436c4
2.33.1
a436c4