]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/shared/output-mode.c
license: LGPL-2.1+ -> LGPL-2.1-or-later
[thirdparty/systemd.git] / src / shared / output-mode.c
CommitLineData
db9ecf05 1/* SPDX-License-Identifier: LGPL-2.1-or-later */
766cd081
LP
2
3#include "output-mode.h"
4#include "string-table.h"
5
9e964bb8
LP
6JsonFormatFlags output_mode_to_json_format_flags(OutputMode m) {
7
8 switch (m) {
9
10 case OUTPUT_JSON_SSE:
11 return JSON_FORMAT_SSE;
12
13 case OUTPUT_JSON_SEQ:
14 return JSON_FORMAT_SEQ;
15
16 case OUTPUT_JSON_PRETTY:
17 return JSON_FORMAT_PRETTY;
18
19 default:
20 return JSON_FORMAT_NEWLINE;
21 }
22}
23
766cd081
LP
24static const char *const output_mode_table[_OUTPUT_MODE_MAX] = {
25 [OUTPUT_SHORT] = "short",
29a753df 26 [OUTPUT_SHORT_FULL] = "short-full",
766cd081 27 [OUTPUT_SHORT_ISO] = "short-iso",
7e563bfc 28 [OUTPUT_SHORT_ISO_PRECISE] = "short-iso-precise",
766cd081
LP
29 [OUTPUT_SHORT_PRECISE] = "short-precise",
30 [OUTPUT_SHORT_MONOTONIC] = "short-monotonic",
bb321ed9 31 [OUTPUT_SHORT_UNIX] = "short-unix",
766cd081
LP
32 [OUTPUT_VERBOSE] = "verbose",
33 [OUTPUT_EXPORT] = "export",
34 [OUTPUT_JSON] = "json",
35 [OUTPUT_JSON_PRETTY] = "json-pretty",
36 [OUTPUT_JSON_SSE] = "json-sse",
8e044443 37 [OUTPUT_JSON_SEQ] = "json-seq",
49805b3d
LB
38 [OUTPUT_CAT] = "cat",
39 [OUTPUT_WITH_UNIT] = "with-unit",
766cd081
LP
40};
41
42DEFINE_STRING_TABLE_LOOKUP(output_mode, OutputMode);