From 695fd479be6796fdad5b79c0ecbd22e25cee750b Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 16 Sep 2016 14:18:01 +0200 Subject: tests: add columns separator to libsmartcols test Signed-off-by: Karel Zak --- libsmartcols/samples/fromfile.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'libsmartcols/samples') diff --git a/libsmartcols/samples/fromfile.c b/libsmartcols/samples/fromfile.c index 6b9748897..6d4ee4aaf 100644 --- a/libsmartcols/samples/fromfile.c +++ b/libsmartcols/samples/fromfile.c @@ -197,7 +197,8 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out) fputs(" -n, --nlines number of lines\n", out); fputs(" -J, --json JSON output format\n", out); fputs(" -r, --raw RAW output format\n", out); - fputs(" -E, --export use key=\"value\" output format\n", out); + fputs(" -E, --export use key=\"value\" output format\n", out); + fputs(" -C, --colsep set columns separator\n", out); fputs(" -w, --width hardcode terminal width\n", out); fputs(" -p, --tree-parent-column parent column\n", out); fputs(" -i, --tree-id-column id column\n", out); @@ -223,6 +224,7 @@ int main(int argc, char *argv[]) { "json", 0, 0, 'J' }, { "raw", 0, 0, 'r' }, { "export", 0, 0, 'E' }, + { "colsep", 1, 0, 'C' }, { "help", 0, 0, 'h' }, { NULL, 0, 0, 0 }, }; @@ -240,7 +242,7 @@ int main(int argc, char *argv[]) if (!tb) err(EXIT_FAILURE, "failed to create output table"); - while((c = getopt_long(argc, argv, "hc:Ei:Jmn:p:rw:", longopts, NULL)) != -1) { + while((c = getopt_long(argc, argv, "hCc:Ei:Jmn:p:rw:", longopts, NULL)) != -1) { err_exclusive_options(c, longopts, excl, excl_st); @@ -278,6 +280,9 @@ int main(int argc, char *argv[]) case 'E': scols_table_enable_export(tb, TRUE); break; + case 'C': + scols_table_set_column_separator(tb, optarg); + break; case 'n': nlines = strtou32_or_err(optarg, "failed to parse number of lines"); break; -- cgit v1.2.3-55-g7522