]> git.ipfire.org Git - thirdparty/systemd.git/commit
json: add new json format flag for disabling JSON output
authorLennart Poettering <lennart@poettering.net>
Sat, 9 Jan 2021 15:56:00 +0000 (16:56 +0100)
committerLennart Poettering <lennart@poettering.net>
Sat, 9 Jan 2021 16:35:58 +0000 (17:35 +0100)
commit10d7126365587e449ffe81b9ab7335be4e10cc68
treeb56de028f1b5e58ee1a5fef5cadd9c3e6a7c1945
parent28abf5ad3483a417d3d4de561533d282493a7f2a
json: add new json format flag for disabling JSON output

This adds a new flag JSON_FORMAT_OFF that is a marker for "no JSON
output please!".

Of course, this flag sounds pointless in a JSON implementation, however
this is useful in code that can generate JSON output, but also more
human friendly output (for example our table formatters).

With this in place various tools that so far maintained one boolean
field "arg_json" that controlled whether JSON output was requested at
all and another field "arg_json_format_flags" for selecing the precise
json output flags may merge them into one, simplifying code a bit.
src/shared/format-table.c
src/shared/json.c
src/shared/json.h