btrfs-progs/common
David Sterba 3122085a79 btrfs-progs: output formatter infrastructure
Add structures and API for unified output definition and multiple
formatting backends. Currently there's plain text and json.

The format of each row is defined in struct rowspec, selected using a
key and formatted according to the type. There are extended types for
eg. UUID or pretty size, while direct printf format specifiers work too.

Due to different nature of the outputs, the context structure members
are not always used.

* text output mostly uses indentation and formats the name to a given
  width

* json output tracks nesting depth and keeps stack of previous groups
  (list or array) and how many member have been printed, as the
  separators are allowed only between values and must not preced the
  group closing bracket
  the nesting depth is hardcoded to 16, counting the global group

The API provides functions to print simple values and some helpers to
format more complex structures.

Signed-off-by: David Sterba <dsterba@suse.com>
2019-07-03 20:49:04 +02:00
..
format-output.c btrfs-progs: output formatter infrastructure 2019-07-03 20:49:04 +02:00
format-output.h btrfs-progs: output formatter infrastructure 2019-07-03 20:49:04 +02:00
fsfeatures.c btrfs-progs: move utils.[ch] to common/ 2019-07-03 20:49:04 +02:00
fsfeatures.h btrfs-progs: move fsfeatures.[ch] to common/ 2019-07-03 20:49:03 +02:00
help.c btrfs-progs: define new output format: json 2019-07-03 20:49:04 +02:00
help.h btrfs-progs: define new output format: json 2019-07-03 20:49:04 +02:00
internal.h
messages.c btrfs-progs: move messages.[ch] to common/ 2019-07-03 20:49:03 +02:00
messages.h btrfs-progs: move messages.[ch] to common/ 2019-07-03 20:49:03 +02:00
rbtree-utils.c btrfs-progs: move rbtree-utils.[ch] to common/ 2019-07-03 20:49:04 +02:00
rbtree-utils.h btrfs-progs: move rbtree-utils.[ch] to common/ 2019-07-03 20:49:04 +02:00
string-table.c btrfs-progs: move string-table.[ch] to common/ 2019-07-03 20:49:03 +02:00
string-table.h btrfs-progs: move string-table.[ch] to common/ 2019-07-03 20:49:03 +02:00
task-utils.c btrfs-progs: move task-utils.[ch] to common/ 2019-07-03 20:49:03 +02:00
task-utils.h btrfs-progs: move task-utils.[ch] to common/ 2019-07-03 20:49:03 +02:00
utils.c btrfs-progs: add support for output formats 2019-07-03 20:49:04 +02:00
utils.h btrfs-progs: add support for output formats 2019-07-03 20:49:04 +02:00