zpwr: Adapt to new JSON Lines text format

util_fmt now provides support for JSON Lines text format. Adapt certain
checks in the code and document the newly supported format in the man
page accordingly.

Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Jan Höppner
2026-04-01 18:38:11 +02:00
parent 3485192791
commit f302f5734b
2 changed files with 5 additions and 5 deletions

View File

@@ -30,8 +30,8 @@ CPC readings include total, unassigned resources and infrastructure power
readings.
.sp
Power reading units are automatically presented in a human readable format,
whereas complex formats like json, csv, json-seq, pairs display the power
readings in microwatts.
whereas complex formats like json, csv, json-seq, jsonl, pairs display the
power readings in microwatts.
.sp
CPC power readings can be retrieved only when the required authorization was
set for the LPAR. Enable the required authorization by setting "Global
@@ -48,7 +48,7 @@ Retrieve power readings in the following formats: json, csv,
json-seq or pairs. If no format is specified in the command, the output will
default to the human readable format.
.sp
When the format is json, csv, json-seq or pairs, the power readings are
When the format is json, csv, json-seq, jsonl or pairs, the power readings are
displayed in microwatts.
.RE
.PP

View File

@@ -284,7 +284,7 @@ static void fmt_start(enum util_fmt_t fmt, unsigned int fmt_flags,
if (!fmt_specified)
return;
util_fmt_init(stdout, fmt, fmt_flags, 1);
if (fmt != FMT_JSONSEQ)
if (!util_fmt_is_json_stream(fmt))
util_fmt_obj_start(FMT_LIST, "zpwr");
}
@@ -292,7 +292,7 @@ static void fmt_end(enum util_fmt_t fmt, int fmt_specified)
{
if (!fmt_specified)
return;
if (fmt != FMT_JSONSEQ)
if (!util_fmt_is_json_stream(fmt))
util_fmt_obj_end(); /* zpwr[] */
util_fmt_exit();
}