Commit Graph

54 Commits

Author SHA1 Message Date
Karel Zak 40a4845693 libsmartcols: (docs) add missing references
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-22 10:34:14 +02:00
Karel Zak 24cee7157a docs: update year in libs docs
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-06 12:59:45 +01:00
Karel Zak 94dbb32273 libsmartcols: cleanup and extend padding functionality
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>
2019-07-23 16:24:42 +02:00
Karel Zak ed16c910be libsmartcols: fix docs
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-06-13 13:45:46 +02:00
Karel Zak 36ad92c23e libsmartcols: (docs) add reference to v2.33 and v2.34
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-06-07 12:32:45 +02:00
Karel Zak 4f4c2b3cdd libsmartcols: add grouping API docs
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-12-07 12:33:34 +01:00
Karel Zak b2c871f978 libsmartcols: improve JSON support (add types)
This commit add SCOLS_JSON_{NUMBER,STRING,BOOLEAN} to specify column
type for JSON output formatting.

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-04-03 15:10:10 +02:00
Karel Zak ab0ede8619 libsmartcols: (docs) update year
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-20 18:55:36 +01:00
Karel Zak aef70f5514 libsmartcols: fix docs warnings
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-02-21 13:23:19 +01:00
Ruediger Meier 73afd3f8e8 misc: fix typos using codespell
Some more funny typos, please review carefully.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-02-16 11:12:52 +01:00
Karel Zak 28a3cc83c5 libsmartcols: add scols_table_enable_noencoding()
Now the library encode all output. It seems too strict and difficult
to use the library for some use-cases -- for example if you want to
use the library for already colorized output (by esc.sequences).

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-07-31 11:45:23 +02:00
Karel Zak f12e437436 libsmartcols: (docs) add new functions
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-13 11:17:06 +02:00
Karel Zak 4ab60277cb libsmartcols: (docs) add missing 'since' tags
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-23 13:27:29 +02:00
Karel Zak eebf2dd89b libsmartcols: add scols_line_is_ancestor()
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-05 12:12:43 +02:00
Karel Zak 066f46e0ee libsmartcols: add scols_sort_table_by_tree()
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-04-13 11:19:59 +02:00
Karel Zak 7bdefc7fc0 libsmartcols: add scols_table_move_column()
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-04-07 14:34:11 +02:00
Karel Zak 6ffbd28359 libsmartcols: add scols_cell_get_alignment()
Just to hide that we use cell flags (bitwise operations) to define
cell content alignment. The patch also more explicitly specifies the
flags in the header file.

The alignment is evaluated in the order: right, center, left. The
default is left.

Note that SCOLS_CELL_FL_* are used for for table title only.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-01-09 13:28:24 +01:00
Sébastien Helleu d673b74e9d docs: replace FTP by HTTPS in kernel.org URLs
The links to ftp://ftp.kernel.org/ are replaced by
https://www.kernel.org/.

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-12-19 11:22:26 +01:00
Karel Zak 82053f5e3d libsmartcols: add scols_column_add_width()
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-09-30 11:01:41 +02:00
Karel Zak 81b176c4da docs: some random fixes
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-09-27 12:52:47 +02:00
Igor Gnatenko 618a1d6dbe libsmartcols: fixes in doc generation
* Add 2.29 symbols index
* Sync argument names between header and implementation

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-09-27 11:19:03 +02:00
Karel Zak 949ea05f1a libsmartcols: support custom wrap and remove SCOLS_FL_WRAPNL
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>
2016-09-26 11:20:07 +02:00
Karel Zak 0d71eb9c4b libsmartcols: (docs) add missing functions
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-09-23 14:31:06 +02:00
Karel Zak 63168cf9b5 libsmartcols: cleanup scols_table_set_symbols() API
Change behavior:
  * scols_table_set_symbols(tb, NULL) remove reference to the current symbols setting
    and does not set default symbols at all

Add new functions:
  * scols_table_get_symbols()
  * scols_table_set_default_symbols()

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-09-23 14:20:24 +02:00
Karel Zak 19055a25ed libsmartcols: add functions to control terminal usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-09-13 14:06:01 +02:00
Karel Zak 64ce7cbbc0 libsmartcols: allow to change cell padding char
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-09-07 11:07:04 +02:00
Karel Zak ff471d89a1 libsmartcols: support multi-line cells based on line breaks
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>
2016-09-06 10:51:25 +02:00
Igor Gnatenko cfa185721e libsmartcols: implement scols_table_print_range_to_string
Reference: https://github.com/karelzak/util-linux/issues/283
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-02-21 21:13:50 +01:00
Karel Zak 2981e0fd0e libsmartcols: support continuous printing
This patch allows to disable line-breaks. This feature is usable when
you want to re-print the same line more than once -- move terminal
cursor to the begin of the line and print again and again (aka
progress bar).

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-02-19 16:43:28 +01:00
Karel Zak 2a750b4c4e libsmartcols: add scols_table_print_range()
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-02-19 14:43:06 +01:00
Karel Zak e865838d6d libsmartcols: use libscols_cell for title
References: https://github.com/karelzak/util-linux/issues/270
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-02-09 11:21:21 +01:00
Karel Zak d372bcf26e Merge branch 'scols_fl_wrap' of https://github.com/ignatenkobrain/util-linux
* 'scols_fl_wrap' of https://github.com/ignatenkobrain/util-linux:
  libsmartcols: add scols_column_is_wrap to docs
  libsmartcols: don't loose colors when wrapping
  libsmartcols: wrap columns correctly with unicode
  libsmartcols: implement SCOLS_FL_WRAP
2016-01-25 13:03:29 +01:00
Karel Zak 982034c3d1 libsmartcols: document v2.27 symbols
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-01-25 12:57:14 +01:00
Igor Gnatenko db307d8e96 libsmartcols: add 'Since' tag for gtkdoc for some functions
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-01-25 00:12:14 +01:00
Igor Gnatenko 703d0196ee libsmartcols: add few methods to get information about title
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-01-25 00:12:14 +01:00
Karel Zak 57867795aa libsmartcols: support multibyte titles, rename wrap to padding
- let's support multibyte table titles
- use lib/mbalign.c to align the title
- rename title_wrap to title_padding (we already use "wrap" on another
  places for another things)

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-01-22 16:51:59 +01:00
Igor Gnatenko ad13ab8d66 libsmartcols: add scols_column_is_wrap to docs
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-01-22 14:48:46 +01:00
Karel Zak 500a229f51 libsmartcols: add new functions to docs
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-01-22 13:40:19 +01:00
Karel Zak 7837186515 libsmartcols: allow to set data by reference to libscols_column
References: https://github.com/karelzak/util-linux/issues/251
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-01-12 11:39:03 +01:00
Karel Zak 6d6b6d185e libsmartcols: add SCOLS_FL_HIDDEN
Export "don't print this column" functionality by public API.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-12-10 13:02:03 +01:00
Karel Zak df73852b6e libsmartcols: add scols_table_enable_nowrap()
This allows to use libsmartcols in ncurses programs without any
additional voodoo.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-12-07 12:03:52 +01:00
Karel Zak 2a6cfc1361 libsmartcols: add JSON output format
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-04 15:47:21 +02:00
Karel Zak d5dbd57b22 docs: fix gtk-docs related warnings
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-05-28 12:28:23 +02:00
Karel Zak 2b6c532e17 docs: update API docs years
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-13 12:03:17 +01:00
Karel Zak 5bc118c3c2 libsmartcols: fix docs namespace
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-11-26 16:53:48 +01:00
Karel Zak 7a1c36ab38 docs: rename libs xml/version.xml to xml/version-utils.xml
It seems that gtk-docs stuff is confused when we use version.xml
(package version) and xml/version.xml (library version functions).

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-06-03 12:37:33 +02:00
Karel Zak 57a86f9bff libsmartcols: add scols_sort_table()
* add pointer to column cmp() function [scols_column_set_cmpfunc()]

 * allow to store per-cell application private data
   (to make it possible to sort tables on data independent on cell
    output data) [scols_cell_set_userdata() ...]

 * make it possible to access line cell by column
   [scols_line_get_column_cell()]

Sort and cmp() stuff based on patches from Shakur Shams Mullick.

Co-Author: Shakur Shams Mullick <shakursmullick@gmail.com>
Signed-off-by: Shakur Shams Mullick <shakursmullick@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-20 15:04:11 +02:00
Karel Zak c60329b33f libsmartcols: (docs) reorder functions in version section
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-07 11:48:53 +02:00
Ondrej Oprala d1b4d14f4d libsmartcols: add separator getters/setters
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2014-04-14 12:37:21 +02:00
Karel Zak e2310281c7 libsmartcols: improve docs
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-07 14:07:49 +02:00