summaryrefslogtreecommitdiffstats
path: root/libsmartcols/samples/wrap.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:33:32 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:33:32 +0000
commit8bb05ac73a5b448b339ce0bc8d396c82c459b47f (patch)
tree1fdda006866bca20d41cb206767ea5241e36852f /libsmartcols/samples/wrap.c
parentAdding debian version 2.39.3-11. (diff)
downloadutil-linux-8bb05ac73a5b448b339ce0bc8d396c82c459b47f.tar.xz
util-linux-8bb05ac73a5b448b339ce0bc8d396c82c459b47f.zip
Merging upstream version 2.40.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libsmartcols/samples/wrap.c')
-rw-r--r--libsmartcols/samples/wrap.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libsmartcols/samples/wrap.c b/libsmartcols/samples/wrap.c
index 795bef7..8368304 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");