cli: changing nmcli output to better fit both computer and human needs
The output is basically tabular with fields (columns) presenting specific pieces of info. Each line represents a single object. It's possible to switch to multiline output using '--multiline' option. In that mode single object is presented on more lines - each field on its line. Terse mode now uses ':' as field separator. It also escapes all occurences of ':' and '\' inside field values to ease parsing. The escaping behaviour can be controlled through '--escape' option. By default, escaping is switched on in tabular mode. When using terse mode ('--terse'), '--fields' option is mandatory for specifying required fields. That helps for flexibility and backwards compatibility. Not all output is converted yet.
This commit is contained in:
@@ -20,8 +20,15 @@
|
||||
#ifndef NMC_UTILS_H
|
||||
#define NMC_UTILS_H
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include "nmcli.h"
|
||||
|
||||
/* === Functions === */
|
||||
int matches (const char *cmd, const char *pattern);
|
||||
int next_arg (int *argc, char ***argv);
|
||||
GArray *parse_output_fields (const char *fields_str, const NmcOutputField fields_array[], GError **error);
|
||||
void print_fields (const NmcPrintFields fields, const NmcOutputField field_values[]);
|
||||
void print_table_header (const char *name, ...);
|
||||
void print_table_line (int indent, ...);
|
||||
|
||||
|
Reference in New Issue
Block a user