NetworkManager/clients/common
Thomas Haller fdd40b6a68 cli: implement new nmc_print() command to generically output cli data
We already have
  - data sources (nm_cli, connections or settings)
  - meta data information how to access the data sources (NMMetaAbstractInfo,
    NmcMetaGenericInfo, NMMetaPropertyInfo)

Add now a generic way to output cli data using nmc_print(). It gets a
list of data-sources (@targets) and a list of available fields (meta
data). It also gets cli configuration (NmcConfig) and field selector
strings (@field_str).

Based on that, it should output the desired data.

This is intended to replaces the previous approach, where functions like
show_nm_status() have full knowledge about how to access the data and
create an intermediate output format (NmcOutputData, NmcOutputField)
that was printed via print_data().
show_nm_status() contained both knowledge about the data itself (how to
print a value) and intimate knoweledge about the output intermediate
format. Also, the intermediate format is hard to understand. For
example, sometimes we put the field prefix in NmcOutputField at index 0
and via the NmcOfFlags we control how to output the data.

Clearly separate the responsibilities.

  - The meta data (NmcMetaGenericInfo) is only concerned with converting
    a data source to a string (or a color format).
  - the field selection (@field_str) only cares about parsing the list
    of NMMetaAbstractInfo.
  - _print_fill() populates a table with output values and header
    entries.
  - _print_do() prints the previously prepared table.

The advantage is that if you want to change anything, you only need to
touch a particular part.

This is only a show-case for `nmcli general status`. Parts are still
un-implemented and will follow.

This changes behavior for --terse mode: the values are now no longer
translated:
  $ LANG=de_DE.utf8 nmcli -t --mode multiline general
2017-04-12 11:24:04 +02:00
..
tests cli/tests: add "clients/common/tests/test-general.c" 2017-04-05 16:53:06 +02:00
nm-client-utils.c cli: move nmc_bond_validate_mode() to "clients/common/nm-client-utils.h" 2017-04-05 16:53:06 +02:00
nm-client-utils.h cli: move nmc_bond_validate_mode() to "clients/common/nm-client-utils.h" 2017-04-05 16:53:06 +02:00
nm-meta-setting-access.c cli: implement new nmc_print() command to generically output cli data 2017-04-12 11:24:04 +02:00
nm-meta-setting-access.h cli: implement new nmc_print() command to generically output cli data 2017-04-12 11:24:04 +02:00
nm-meta-setting-desc.c cli: fix invalid assertion 2017-04-06 15:41:27 +02:00
nm-meta-setting-desc.h cli: implement new nmc_print() command to generically output cli data 2017-04-12 11:24:04 +02:00
nm-polkit-listener.c all: cleanup includes and let "nm-default.h" include "config.h" 2016-02-19 17:53:25 +01:00
nm-polkit-listener.h all: cleanup includes in header files 2016-08-17 19:51:17 +02:00
nm-secret-agent-simple.c cli: fix leak in add_vpn_secrets() 2017-04-05 14:18:55 +02:00
nm-secret-agent-simple.h include: use double-quotes to include our own headers 2017-03-09 14:12:35 +01:00
nm-vpn-helpers.c cli: make static arrays in nm_vpn_get_secret_names() const 2017-04-05 14:18:55 +02:00
nm-vpn-helpers.h include: use double-quotes to include our own headers 2017-03-09 14:12:35 +01:00
settings-docs.c.in build: commit pre-generated "settings-docs.c" in git 2017-04-05 16:53:06 +02:00
settings-docs.xsl cli: embed gtk-doc directly in property-info structure 2017-03-30 16:35:52 +02:00