lshw/0019-JSON-output-clean-up-list-object.patch

50 lines
1.1 KiB
Diff
Raw Normal View History

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