Commit Graph

112 Commits

Author SHA1 Message Date
Karel Zak 2f09ae9d5d libsmartcols: add samples directory
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-01-25 13:17:43 +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
Igor Gnatenko bfc3d8b48e libsmartcols: position of title in fact unsigned
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
Igor Gnatenko 57c7b2a1a5 libsmartcols: don't loose colors when wrapping
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-01-22 14:30:39 +01:00
Igor Gnatenko e6f89163be libsmartcols: wrap columns correctly with unicode
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-01-22 14:29:16 +01:00
Karel Zak fd5cbf57e0 libsmartcols: add title to the test application
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-01-22 13:50:02 +01:00
Karel Zak 6f2737964d libsmartcols: add JSON to the test application
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-01-22 13:46:29 +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
Igor Gnatenko 0a69e647fc libsmartcols: set everything once in scols_table_set_title()
Reported-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-01-22 12:54:02 +01:00
Igor Gnatenko a640409309 libsmartcols: implement SCOLS_FL_WRAP
Reference: https://github.com/karelzak/util-linux/issues/257
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-01-22 12:51:45 +01:00
Igor Gnatenko 2f62d9fe3e libsmartcols: put new line after title
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-01-21 17:37:21 +01:00
Igor Gnatenko 7bc451694f libsmartcols: fix title aligning to center
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-01-21 17:36:53 +01:00
Igor Gnatenko 284ee2a9a4 libsmartcols: don't try to align title if it's more that term
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-01-21 17:25:15 +01:00
Igor Gnatenko cd32dc248c libsmartcols: use symbols for title wrap
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-01-21 17:09:16 +01:00
Igor Gnatenko b3256efff2 libsmartcols: implement title of table
Reference: https://github.com/karelzak/util-linux/issues/258
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-01-21 16:41:12 +01:00
Karel Zak 8afabdb1fa libsmartcols: don't sort if cmpfunc() is not set
Reported-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-01-18 10:47:22 +01:00
Karel Zak 7ad4b8503c libsmartcols: be sure column is unused
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-01-18 10:36:31 +01:00
Karel Zak 1bb767f54c Merge branch 'gh/254' of https://github.com/ignatenkobrain/util-linux 2016-01-18 10:24:39 +01:00
Igor Gnatenko d10fa7e6dd libsmartcols: reflect changinging SCOLS_FL_TREE after adding to table
When scols_column_set_flags() is called we will compare before & after
status of SCOLS_FL_TREE flag and appropriately handle tb->ntreecols.

Reference: https://github.com/karelzak/util-linux/issues/254
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-01-17 09:44:09 +01:00
Igor Gnatenko a229e20478 libsmartcols: add scols_column_is_hidden into sym file
In commit 6d6b6d185e we forgot to
add this function to sym file and now we are getting
undefined symbol: scols_column_is_hidden

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-01-15 23:27:52 +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 19981b07d9 libsmartcols: make output buffer size estimation more robust and elegant
Reported-by: Andreas Henriksson <andreas@fatal.se>
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-01-07 17:36:44 +01:00
Boris Egorov 43b4f7ea5f lib/tty: Pass default width to get_terminal_width()
Almost any code calling get_terminal_width() checks returned width for
non-positive values and sets it to some default value (say, 80). So,
let's pass this default value directly to the function.

[kzak@redhat.com: - get_terminal_width() refactoring]

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-01-06 12:22:07 +01:00
Igor Gnatenko 5e8461a53a scols/table_print: restore old stream after printing to str
Reference: https://github.com/karelzak/util-linux/issues/240
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2015-12-13 15:02:05 +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 96561604e2 libsmartcols: fix right-aligned logic for last column
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-12-07 15:10:23 +01:00
Karel Zak 05c1123bc3 libsmartcols: don't use fprintf() when count cells
fprintf("%*s") is based on bytes, no cells.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-12-07 12:22:29 +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 c600d82a3a libsmartcols: make sure we have space for ascii art
* more verbose output about columns width counting
* strlen_line() does not care about space between columns and extra
  tree ASCII art. Let's assume that all termwith is possible to use
  for this extra stuff, it means that maximal buffer size is
  biggest_line + termwidth.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-11-30 12:53:42 +01:00
Karel Zak 440f73b7bc libsmartcols: allow to reduce tree columns
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-11-30 11:43:05 +01:00
Karel Zak 2c6567799d build-sys: add --disable-assert
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-08-04 13:40:44 +02:00
Karel Zak fdd68e25b5 libsmartcols: make child-parent reference more robust [clang analyze]
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-07-29 14:44:27 +02:00
Karel Zak 5627fcec0e libsmartcols: reduce relative columns more aggressively
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-07-27 14:29:38 +02:00
Karel Zak 0bef6f759b libsmartcols: don't link with tinfo
Let's move color names to sequence translation to separate file to
make it usable without all the stuff in lib/colors.c.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-07-24 12:57:46 +02:00
Karel Zak 6a768b5516 libsmartcols: keep JSON field names lower-case
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-05 11:58:42 +02:00
Karel Zak 4827093d4b losetup: add --json
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-05 10:30:52 +02: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 4310faf950 lib/colors: use libtinfo to check terminal capability
The current implementation assumes that all terminals supports colors
and users are forcet to use terminal-colors.d/ to disable colors for
some terminals.

This patch checks for maximal supported colors for the current
terminal and colors are automatically disabled for terminals like
vt100.

The patch moves lib/colors.c from libcommon.la to libtcolors.la to
avoid collisions with another utils.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-02-27 13:57:34 +01:00
Karel Zak 323da9ce47 libsmartcols: remove assert(arg) from public functions
Reported-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-02-16 13:49:29 +01:00
Karel Zak 78ad5aaaa9 libsmartcols: remove unnecessary check [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-29 11:07:37 +01:00
Benno Schulenberg b295bdb1b5 docs: fix two "maybe be" duplications in program comments
Also improve the grammar of the comments and some neighbours.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-26 11:22:15 +01:00
Karel Zak 2473b71182 libsmartcols: (docs) improve section descriptions
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-13 12:23:40 +01: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 fed9b1775d libsmartcols: cleanup gtk-docs warnings
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-13 11:56:57 +01:00