From b24cdac1e702db86aa17e722d0ed0219588a0d13 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 19 Oct 2023 12:42:35 +0200 Subject: [PATCH] libsmartcols: add --{export,raw,json} to wrap sample Signed-off-by: Karel Zak --- libsmartcols/samples/wrap.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libsmartcols/samples/wrap.c b/libsmartcols/samples/wrap.c index 795bef7140..836830402d 100644 --- a/libsmartcols/samples/wrap.c +++ b/libsmartcols/samples/wrap.c @@ -92,7 +92,15 @@ int main(int argc, char *argv[]) if (!tb) err(EXIT_FAILURE, "failed to create output table"); - scols_table_enable_colors(tb, isatty(STDOUT_FILENO)); + if (argc > 1 && strcmp(argv[1], "--export") == 0) + scols_table_enable_export(tb, 1); + else if (argc > 1 && strcmp(argv[1], "--raw") == 0) + scols_table_enable_raw(tb, 1); + else if (argc > 1 && strcmp(argv[1], "--json") == 0) + scols_table_enable_json(tb, 1); + else + scols_table_enable_colors(tb, isatty(STDOUT_FILENO)); + setup_columns(tb); ln = add_line(tb, NULL, "A"); -- 2.47.3