summaryrefslogtreecommitdiff
path: root/clients/cli/utils.c
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2018-02-27 16:28:28 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2018-02-28 09:32:28 +0100
commitbfebf9d9598186d57eb58b1d7431b90073f10203 (patch)
tree80655f2114867ebe2ec652bd4eff4132291f7782 /clients/cli/utils.c
parentd5c4356f61941eff7c795ec44f8eed4e4fd3dc23 (diff)
downloadNetworkManager-bg/nmcli-overview.tar.gz
nmcli: add overview mode to skip default values in outputbg/nmcli-overview
(final name of the option still to be defined) Example: $ nmcli -o connection show wifi-home connection.id: wifi-home connection.uuid: 8308c425-f2a7-4021-9afc-37bde7253c6d connection.type: 802-11-wireless connection.timestamp: 1519264421 connection.permissions: user:bgalvani 802-11-wireless.ssid: home 802-11-wireless.mode: infrastructure 802-11-wireless-security.key-mgmt: wpa-psk 802-11-wireless-security.auth-alg: open ipv4.method: auto ipv6.method: auto https://bugzilla.redhat.com/show_bug.cgi?id=1434527
Diffstat (limited to 'clients/cli/utils.c')
-rw-r--r--clients/cli/utils.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/clients/cli/utils.c b/clients/cli/utils.c
index abf81fc521..6a2e899752 100644
--- a/clients/cli/utils.c
+++ b/clients/cli/utils.c
@@ -1004,6 +1004,7 @@ typedef struct {
const PrintDataCol *col;
const char *title;
bool title_to_free:1;
+ bool skip:1;
int width;
} PrintDataHeaderCell;
@@ -1102,6 +1103,7 @@ _print_fill (const NmcConfig *nmc_config,
header_cell->col_idx = col_idx;
header_cell->col = col;
+ header_cell->skip = FALSE;
header_cell->title = nm_meta_abstract_info_get_name (info, TRUE);
if ( nmc_config->multiline_output
@@ -1136,7 +1138,7 @@ _print_fill (const NmcConfig *nmc_config,
for (i_col = 0; i_col < header_row->len; i_col++) {
char *to_free = NULL;
PrintDataCell *cell = &cells_line[i_col];
- const PrintDataHeaderCell *header_cell;
+ PrintDataHeaderCell *header_cell;
const NMMetaAbstractInfo *info;
NMMetaAccessorGetOutFlags text_out_flags, color_out_flags;
gconstpointer value;
@@ -1157,6 +1159,9 @@ _print_fill (const NmcConfig *nmc_config,
&text_out_flags,
&is_default,
(gpointer *) &to_free);
+
+ header_cell->skip = nmc_config->overview && is_default;
+
if (NM_FLAGS_HAS (text_out_flags, NM_META_ACCESSOR_GET_OUT_FLAGS_STRV)) {
if (value) {
if (nmc_config->multiline_output) {
@@ -1240,6 +1245,9 @@ _print_skip_column (const NmcConfig *nmc_config,
selection_item = header_cell->col->selection_item;
info = selection_item->info;
+ if (header_cell->skip)
+ return TRUE;
+
if (nmc_config->multiline_output) {
if (info->meta_type == &nm_meta_type_setting_info_editor) {
/* we skip the "name" entry for the setting in multiline output. */