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

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