]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/shared/output-mode.c
mkosi: update arch commit reference
[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
309a747f 6sd_json_format_flags_t output_mode_to_json_format_flags(OutputMode m) {
9e964bb8
LP
7
8 switch (m) {
9
10 case OUTPUT_JSON_SSE:
309a747f 11 return SD_JSON_FORMAT_SSE;
9e964bb8
LP
12
13 case OUTPUT_JSON_SEQ:
309a747f 14 return SD_JSON_FORMAT_SEQ;
9e964bb8
LP
15
16 case OUTPUT_JSON_PRETTY:
309a747f 17 return SD_JSON_FORMAT_PRETTY;
9e964bb8
LP
18
19 default:
309a747f 20 return SD_JSON_FORMAT_NEWLINE;
9e964bb8
LP
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",
893bcd3d 31 [OUTPUT_SHORT_DELTA] = "short-delta",
bb321ed9 32 [OUTPUT_SHORT_UNIX] = "short-unix",
766cd081
LP
33 [OUTPUT_VERBOSE] = "verbose",
34 [OUTPUT_EXPORT] = "export",
35 [OUTPUT_JSON] = "json",
36 [OUTPUT_JSON_PRETTY] = "json-pretty",
37 [OUTPUT_JSON_SSE] = "json-sse",
8e044443 38 [OUTPUT_JSON_SEQ] = "json-seq",
49805b3d
LB
39 [OUTPUT_CAT] = "cat",
40 [OUTPUT_WITH_UNIT] = "with-unit",
766cd081
LP
41};
42
43DEFINE_STRING_TABLE_LOOKUP(output_mode, OutputMode);