cli: allow specifying 'group.name' syntax for '--fields'
and use it for 'nmcli device show'. This allows filtering output not only for whole groups, but also for individual fields in commands that print data in groups (sections). Example: $ nmcli -f general.device,general.driver,ipv4,ipv6.address device show eth0 GENERAL.DEVICE: eth0 GENERAL.DRIVER: e1000e IP4.ADDRESS[1]: ip = 10.0.5.228/23, gw = 10.0.5.254 IP4.ADDRESS[2]: ip = 5.5.5.5/32, gw = 5.5.5.1 IP4.DNS[1]: 192.168.122.1 IP4.DNS[2]: 8.8.8.8 IP4.DOMAIN[1]: mycompany.com
This commit is contained in:
@@ -74,14 +74,15 @@ typedef enum {
|
||||
#define NMC_OF_FLAG_MAIN_HEADER_ADD 0x00000004 /* Print main header in addition to values/field names */
|
||||
#define NMC_OF_FLAG_MAIN_HEADER_ONLY 0x00000008 /* Print main header only */
|
||||
|
||||
typedef struct {
|
||||
const char *name; /* Field's name */
|
||||
const char *name_l10n; /* Field's name for translation */
|
||||
int width; /* Width in screen columns */
|
||||
void *value; /* Value of current field - char* or char** (NULL-terminated array) */
|
||||
gboolean value_is_array; /* Whether value is char ** instead of char* */
|
||||
gboolean free_value; /* Whether to free the value */
|
||||
guint32 flags; /* Flags - whether and how to print values/field names/headers */
|
||||
typedef struct _NmcOutputField {
|
||||
const char *name; /* Field's name */
|
||||
const char *name_l10n; /* Field's name for translation */
|
||||
int width; /* Width in screen columns */
|
||||
struct _NmcOutputField *group; /* Points to an array with available section field names if this is a section (group) field */
|
||||
void *value; /* Value of current field - char* or char** (NULL-terminated array) */
|
||||
gboolean value_is_array; /* Whether value is char** instead of char* */
|
||||
gboolean free_value; /* Whether to free the value */
|
||||
guint32 flags; /* Flags - whether and how to print values/field names/headers */
|
||||
} NmcOutputField;
|
||||
|
||||
typedef struct {
|
||||
|
Reference in New Issue
Block a user