summaryrefslogtreecommitdiffstats
path: root/libsmartcols/samples
Commit message (Collapse)AuthorAgeFilesLines
* libsmartcols: cleanup and extend padding functionalityKarel Zak2019-07-231-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LIBSMARTCOLS_DEBUG_PADDING=on in the next examples forces libsmartcols print '.' as a padding char. See line "ffff" in the exmaples. * default output is to fill all except last cell $ LIBSMARTCOLS_DEBUG_PADDING=on ./sample-scols-fromfile --nlines 10 --width 80 --column tests/ts/libsmartcols/files/col-name --column tests/ts/libsmartcols/files/col-number --column tests/ts/libsmartcols/files/col-string --column tests/ts/libsmartcols/files/col-string tests/ts/libsmartcols/files/data-string tests/ts/libsmartcols/files/data-number tests/ts/libsmartcols/files/data-string-empty tests/ts/libsmartcols/files/data-string-empty 2> /dev/null NAME.. ......NUM STRINGS STRINGS aaaa.. ........0 aaaa... aaaa bbb... ......100 bbb.... bbb ccccc. .......21 ccccc.. ccccc dddddd ........3 dddddd. dddddd ee.... ......411 ee..... ee ffff.. .....5111 ....... gggggg 678993321 gggggg. gggggg hhh... ..7666666 hhh.... hhh * scols_table_enable_minout() minimizes output for tailing empty cells, example: $ LIBSMARTCOLS_DEBUG_PADDING=on ./sample-scols-fromfile --nlines 10 --minout --width 80 --column tests/ts/libsmartcols/files/col-name --column tests/ts/libsmartcols/files/col-number --column tests/ts/libsmartcols/files/col-string --column tests/ts/libsmartcols/files/col-string tests/ts/libsmartcols/files/data-string tests/ts/libsmartcols/files/data-number tests/ts/libsmartcols/files/data-string-empty tests/ts/libsmartcols/files/data-string-empty 2> /dev/null NAME.. ......NUM STRINGS STRINGS aaaa.. ........0 aaaa... aaaa bbb... ......100 bbb.... bbb ccccc. .......21 ccccc.. ccccc dddddd ........3 dddddd. dddddd ee.... ......411 ee..... ee ffff.. .....5111 gggggg 678993321 gggggg. gggggg hhh... ..7666666 hhh.... hhh * cleanup up scols_table_enable_maxout() use, example: $ LIBSMARTCOLS_DEBUG_PADDING=on ./sample-scols-fromfile --nlines 10 --maxout --width 80 --column tests/ts/libsmartcols/files/col-name --column tests/ts/libsmartcols/files/col-number --column tests/ts/libsmartcols/files/col-string --column tests/ts/libsmartcols/files/col-string tests/ts/libsmartcols/files/data-string tests/ts/libsmartcols/files/data-number tests/ts/libsmartcols/files/data-string-empty tests/ts/libsmartcols/files/data-string-empty 2> /dev/null NAME.............. ..................NUM STRINGS............ STRINGS............ aaaa.............. ....................0 aaaa............... aaaa............... bbb............... ..................100 bbb................ bbb................ ccccc............. ...................21 ccccc.............. ccccc.............. dddddd............ ....................3 dddddd............. dddddd............. ee................ ..................411 ee................. ee................. ffff.............. .................5111 ................... ................... gggggg............ ............678993321 gggggg............. gggggg............. hhh............... ..............7666666 hhh................ hhh................ Note that we cannot make scols_table_enable_minout() default because for example "column --table" is pretty commonly used with non-blank columns separator and in this case all cells has to be filled. $ echo -e "aa,b,ccc\na,,\naaa,bbb,ccc" | column --table --separator ',' --output-separator '|' aa |b |ccc a | | aaa|bbb|ccc Addresses: https://github.com/karelzak/util-linux/issues/826 Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: add grouping samplesKarel Zak2018-12-073-0/+290
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sample-scols-title: add left title without paddingKarel Zak2017-12-121-2/+14
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: fix mem-leaks in samplesKarel Zak2017-11-232-0/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: (sample) cleanup line separator usageKarel Zak2017-10-121-3/+12
| | | | | | | | | | | | * add comment to explain when nolinesep flag is necessary * force to print \n before switch to the next line to support ./sample-scols-continuous > file use case. Addresses: https://github.com/ignatenkobrain/python-smartcols/issues/18 Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: never use usage(stderr)Ruediger Meier2017-06-261-4/+5
| | | | | | | Here we fix all cases where we have usage(FILE*) functions. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* build-sys: fix library order when linkingRuediger Meier2017-06-011-1/+1
| | | | | | | | | | We got some errors on Alpine Linux where $LTLIBINTL is non-empty: ./.libs/libcommon.a(libcommon_la-blkdev.o): In function `open_blkdev_or_file': lib/blkdev.c:282: undefined reference to `libintl_gettext collect2: error: ld returned 1 exit status Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* tests: do not use plain 0 as NULL [smatch scan]Sami Kerola2017-03-173-25/+25
| | | | | | Likewise commit 87918040658f2fa9b1bf78f1f8f4f5c065a2e3a3. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libsmartcols: fix test variable shadowingSami Kerola2017-03-171-5/+5
| | | | | | | | | | libsmartcols/samples/fromfile.c:57:16: warning: declaration of 'flags' shadows a global declaration [-Wshadow] libsmartcols/samples/fromfile.c:29:33: note: shadowed declaration is here libsmartcols/samples/fromfile.c:101:8: warning: declaration of 'flags' shadows a global declaration [-Wshadow] Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* docs: Fix word repetitionsYuri Chornoivan2017-02-131-1/+1
|
* misc: fix some compiler warningsRuediger Meier2016-10-271-1/+1
| | | | | | | | | | libsmartcols/samples/fromfile.c:59:2: warning: passing argument 3 of 'string_to_bitmask' from incompatible pointer type text-utils/pg.c:79:0: warning: "TABSIZE" redefined libblkid/src/read.c:455:13: warning: 'debug_dump_dev' defined but not used [-Wunused-function] libblkid/src/probe.c:769:13: warning: unused function 'cdrom_size_correction' [-Wunused-function] /usr/include/sys/termios.h:3:2: warning: "this file includes <sys/termios.h> which is deprecated, use <termios.h> instead" [-W#warnings] Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* libsmartcols: support custom wrap and remove SCOLS_FL_WRAPNLKarel Zak2016-09-261-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This new API provides full control on multi-line cells, you can wrap text by new lines (build-in support) or by another way (after words, commas, etc.) Changes: * new scols_column_set_wrapfunc() sets pointers to two callback functions 1/ chunksize() - returns largest data chunk size; used when we calculate columns width 2/ nextchunk() - terminate the current chunk and returns pointer to the next; used when we print data * remove SCOLS_FL_WRAPNL and add new functions scols_wrapnl_chunksize() and scols_wrapnl_nextchunk() to provide build-in functionality to wrap cells on \n * remove scols_column_is_wrapnl() add scols_column_is_customwrap() (returns true if custom wrap functions are defined) * add scols_column_set_safechars() and scols_column_get_safechars() to allow to control output encoding, safe chars are not encoded by \xFOO * modify "fromfile" test code to use build-in scols_wrapnl_* callbacks for "wrapnl" tests * add new function scols_column_get_table() Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: add columns separator to libsmartcols testKarel Zak2016-09-161-2/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: add export and raw to libsmartcols testKarel Zak2016-09-161-2/+21
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: add JSON support to sample applicationKarel Zak2016-09-161-1/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: add support for trees to the sample applicationKarel Zak2016-09-151-4/+77
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: add libsmartcols title testKarel Zak2016-09-143-3/+20
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: remove dead libsmartcols sampleKarel Zak2016-09-131-5/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: improve libsmartcols testKarel Zak2016-09-131-1/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: add application to test library featuresKarel Zak2016-09-133-141/+230
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: extend wrapnl sampleKarel Zak2016-09-061-12/+19
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: remove debuging code from sampleKarel Zak2016-09-061-5/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: commit missing fileKarel Zak2016-09-061-0/+138
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: support multi-line cells based on line breaksKarel Zak2016-09-061-0/+5
| | | | | | | | | | Now libsmartcols completely control when and how wrap long lines/cells. This is sometimes user unfriendly and it would be nice to support multi-line cells where wrap is based on \n (new line char). This patch add new column flag SCOLS_FL_WRAPNL. Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: use SCOLS_FL_RIGHT in sampleKarel Zak2016-08-311-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: add maxout sampleKarel Zak2016-08-312-1/+62
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: fix scols_table_enable_colors() usage in samplesKarel Zak2016-08-313-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: Fix various typosSebastian Rasmussen2016-05-314-12/+12
| | | | | | | Fix various typos in error messages, warnings, debug strings, comments and names of static functions. Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
* build-sys: add and use openat build conditionalsRuediger Meier2016-03-071-1/+3
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* Merge branch 'ldadd-cflags-warnings' of https://github.com/rudimeier/util-linuxKarel Zak2016-02-242-9/+13
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'ldadd-cflags-warnings' of https://github.com/rudimeier/util-linux: build-sys: disable unused parameter warnings for some test progs misc: fix compiler warnungs (unsigned/signed) misc: fix warnings "unused parameter" [-Wunused-parameter] libfdisk: fix warnings, "redundant redeclaration" [-Wredundant-decls] tests: fix compiler warnings [-Wmissing-prototypes] libfdisk: fix compiler warnings [-Wmissing-prototypes] libfdisk: fix missing symbol libblkid: fix compiler warnings [-Wmissing-prototypes] libmount: add mnt_fs_set_priority() build-sys: always add AM_CFLAGS build-sys: always use global LDADD
| * build-sys: disable unused parameter warnings for some test progsRuediger Meier2016-02-231-8/+12
| | | | | | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
| * tests: fix compiler warnings [-Wmissing-prototypes]Ruediger Meier2016-02-231-1/+1
| | | | | | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
| * build-sys: always add AM_CFLAGSRuediger Meier2016-02-231-4/+4
| | | | | | | | | | | | | | | | We were missing our nice compliler warnings for many programs and libs. See next commits how many trivial and non-trival warnings have to be fixed. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
| * build-sys: always use global LDADDRuediger Meier2016-02-231-4/+4
| | | | | | | | | | | | | | | | This was a major showstopper when building on a system where LTLIBINTL libs are needed (e.g. OSX). Maybe there are a few test programs which wouldn't need LDADD ... never mind. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* | libsmartcols: fix relative column width for maxoutKarel Zak2016-02-241-3/+4
|/ | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: add sample-scols-continuousKarel Zak2016-02-192-1/+135
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: add scols_table_print_range()Karel Zak2016-02-191-12/+35
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: rename strmode() and setmode()Ruediger Meier2016-02-181-1/+1
| | | | | | On BSD they are part of the standard C library. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* libsmartcols: rewrite ./sample-scols-wrapKarel Zak2016-02-101-13/+39
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: use libscols_cell for titleKarel Zak2016-02-091-3/+12
| | | | | References: https://github.com/karelzak/util-linux/issues/270 Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: make SCOLS_FL_WRAP usable in treeKarel Zak2016-01-251-9/+15
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: add wrap.c sampleKarel Zak2016-01-252-1/+85
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: fix title sampleKarel Zak2016-01-251-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: fix samples build, add title.cKarel Zak2016-01-252-0/+106
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: add samples directoryKarel Zak2016-01-251-0/+226
Signed-off-by: Karel Zak <kzak@redhat.com>