cli: reformat file to look better
Comments on the same line as field names are not rendered well by clang-format. Even if manually edited, it seems not a preferable way to comment on a field. Move the comment in the line before.
This commit is contained in:
@@ -52,7 +52,11 @@ typedef enum {
|
|||||||
NMC_RESULT_COMPLETE_FILE = 65,
|
NMC_RESULT_COMPLETE_FILE = 65,
|
||||||
} NMCResultCode;
|
} NMCResultCode;
|
||||||
|
|
||||||
typedef enum { NMC_PRINT_TERSE = 0, NMC_PRINT_NORMAL = 1, NMC_PRINT_PRETTY = 2 } NMCPrintOutput;
|
typedef enum {
|
||||||
|
NMC_PRINT_TERSE = 0,
|
||||||
|
NMC_PRINT_NORMAL = 1,
|
||||||
|
NMC_PRINT_PRETTY = 2,
|
||||||
|
} NMCPrintOutput;
|
||||||
|
|
||||||
static inline NMMetaAccessorGetType
|
static inline NMMetaAccessorGetType
|
||||||
nmc_print_output_to_accessor_get_type(NMCPrintOutput print_output)
|
nmc_print_output_to_accessor_get_type(NMCPrintOutput print_output)
|
||||||
@@ -65,12 +69,17 @@ nmc_print_output_to_accessor_get_type(NMCPrintOutput print_output)
|
|||||||
/* === Output fields === */
|
/* === Output fields === */
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
NMC_OF_FLAG_FIELD_NAMES = 0x00000001, /* Print field names instead of values */
|
/* Print field names instead of values */
|
||||||
NMC_OF_FLAG_SECTION_PREFIX =
|
NMC_OF_FLAG_FIELD_NAMES = 0x00000001,
|
||||||
0x00000002, /* Use the first value as section prefix for the other field names - just in multiline */
|
|
||||||
NMC_OF_FLAG_MAIN_HEADER_ADD =
|
/* Use the first value as section prefix for the other field names - just in multiline */
|
||||||
0x00000004, /* Print main header in addition to values/field names */
|
NMC_OF_FLAG_SECTION_PREFIX = 0x00000002,
|
||||||
NMC_OF_FLAG_MAIN_HEADER_ONLY = 0x00000008, /* Print main header only */
|
|
||||||
|
/* Print main header in addition to values/field names */
|
||||||
|
NMC_OF_FLAG_MAIN_HEADER_ADD = 0x00000004,
|
||||||
|
|
||||||
|
/* Print main header only */
|
||||||
|
NMC_OF_FLAG_MAIN_HEADER_ONLY = 0x00000008,
|
||||||
} NmcOfFlags;
|
} NmcOfFlags;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -85,25 +94,44 @@ typedef struct _NmcMetaGenericInfo NmcMetaGenericInfo;
|
|||||||
struct _NmcOutputField {
|
struct _NmcOutputField {
|
||||||
const NMMetaAbstractInfo *info;
|
const NMMetaAbstractInfo *info;
|
||||||
|
|
||||||
int width; /* Width in screen columns */
|
/* Width in screen columns */
|
||||||
void *value; /* Value of current field - char* or
|
int width;
|
||||||
* char** (NULL-terminated array) */
|
|
||||||
bool value_is_array : 1; /* Whether value is char** instead of char* */
|
/* Value of current field - char* or char** (NULL-terminated array) */
|
||||||
bool free_value : 1; /* Whether to free the value */
|
void *value;
|
||||||
|
|
||||||
|
/* Whether value is char** instead of char* */
|
||||||
|
bool value_is_array : 1;
|
||||||
|
|
||||||
|
/* Whether to free the value */
|
||||||
|
bool free_value : 1;
|
||||||
|
|
||||||
NmcOfFlags flags; /* Flags - whether and how to print values/field names/headers */
|
NmcOfFlags flags; /* Flags - whether and how to print values/field names/headers */
|
||||||
NMMetaColor color; /* Use this color to print value */
|
NMMetaColor color; /* Use this color to print value */
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _NmcConfig {
|
typedef struct _NmcConfig {
|
||||||
NMCPrintOutput print_output; /* Output mode */
|
/* Output mode */
|
||||||
bool use_colors; /* Whether to use colors for output: option '--color' */
|
NMCPrintOutput print_output;
|
||||||
bool multiline_output : 1; /* Multiline output instead of default tabular */
|
|
||||||
bool escape_values : 1; /* Whether to escape ':' and '\' in terse tabular mode */
|
/* Whether to use colors for output: option '--color' */
|
||||||
bool in_editor : 1; /* Whether running the editor - nmcli con edit' */
|
bool use_colors;
|
||||||
bool show_secrets : 1; /* Whether to display secrets (both input
|
|
||||||
* and output): option '--show-secrets' */
|
/* Multiline output instead of default tabular */
|
||||||
bool overview : 1; /* Overview mode (hide default values) */
|
bool multiline_output : 1;
|
||||||
|
|
||||||
|
/* Whether to escape ':' and '\' in terse tabular mode */
|
||||||
|
bool escape_values : 1;
|
||||||
|
|
||||||
|
/* Whether running the editor - nmcli con edit' */
|
||||||
|
bool in_editor : 1;
|
||||||
|
|
||||||
|
/* Whether to display secrets (both input and output): option '--show-secrets' */
|
||||||
|
bool show_secrets : 1;
|
||||||
|
|
||||||
|
/* Overview mode (hide default values) */
|
||||||
|
bool overview : 1;
|
||||||
|
|
||||||
NmcColorPalette palette;
|
NmcColorPalette palette;
|
||||||
} NmcConfig;
|
} NmcConfig;
|
||||||
|
|
||||||
@@ -112,44 +140,69 @@ typedef struct {
|
|||||||
} NmcPagerData;
|
} NmcPagerData;
|
||||||
|
|
||||||
typedef struct _NmcOutputData {
|
typedef struct _NmcOutputData {
|
||||||
GPtrArray *
|
/* GPtrArray of arrays of NmcOutputField structs - accumulates data for output */
|
||||||
output_data; /* GPtrArray of arrays of NmcOutputField structs - accumulates data for output */
|
GPtrArray *output_data;
|
||||||
} NmcOutputData;
|
} NmcOutputData;
|
||||||
|
|
||||||
/* NmCli - main structure */
|
/* NmCli - main structure */
|
||||||
typedef struct _NmCli {
|
typedef struct _NmCli {
|
||||||
NMClient *client; /* Pointer to NMClient of libnm */
|
/* Pointer to NMClient of libnm */
|
||||||
|
NMClient *client;
|
||||||
|
|
||||||
NMCResultCode return_value; /* Return code of nmcli */
|
/* Return code of nmcli */
|
||||||
GString *return_text; /* Reason text */
|
NMCResultCode return_value;
|
||||||
|
|
||||||
|
/* Reason text */
|
||||||
|
GString *return_text;
|
||||||
|
|
||||||
NmcPagerData pager_data;
|
NmcPagerData pager_data;
|
||||||
|
|
||||||
int timeout; /* Operation timeout */
|
/* Operation timeout */
|
||||||
|
int timeout;
|
||||||
|
|
||||||
NMSecretAgentSimple *secret_agent; /* Secret agent */
|
/* Secret agent */
|
||||||
GHashTable *pwds_hash; /* Hash table with passwords in passwd-file */
|
NMSecretAgentSimple *secret_agent;
|
||||||
struct _NMPolkitListener *pk_listener; /* polkit agent listener */
|
|
||||||
|
|
||||||
int should_wait; /* Semaphore indicating whether nmcli should not end or not yet */
|
/* Hash table with passwords in passwd-file */
|
||||||
|
GHashTable *pwds_hash;
|
||||||
|
|
||||||
bool nowait_flag : 1; /* '--nowait' option; used for passing to callbacks */
|
/* polkit agent listener */
|
||||||
bool mode_specified : 1; /* Whether tabular/multiline mode was specified via '--mode' option */
|
struct _NMPolkitListener *pk_listener;
|
||||||
bool offline : 1; /* Communicate the connection data over stdin/stdout
|
|
||||||
* instead of talking to the daemon. */
|
/* Semaphore indicating whether nmcli should not end or not yet */
|
||||||
bool ask : 1; /* Ask for missing parameters: option '--ask' */
|
int should_wait;
|
||||||
bool complete : 1; /* Autocomplete the command line */
|
|
||||||
bool editor_status_line : 1; /* Whether to display status line in connection editor */
|
/* '--nowait' option; used for passing to callbacks */
|
||||||
bool editor_save_confirmation : 1; /* Whether to ask for confirmation on
|
bool nowait_flag : 1;
|
||||||
* saving connections with 'autoconnect=yes' */
|
|
||||||
|
/* Whether tabular/multiline mode was specified via '--mode' option */
|
||||||
|
bool mode_specified : 1;
|
||||||
|
|
||||||
|
/* Communicate the connection data over stdin/stdout instead of talking to the daemon. */
|
||||||
|
bool offline : 1;
|
||||||
|
|
||||||
|
/* Ask for missing parameters: option '--ask' */
|
||||||
|
bool ask : 1;
|
||||||
|
|
||||||
|
/* Autocomplete the command line */
|
||||||
|
bool complete : 1;
|
||||||
|
|
||||||
|
/* Whether to display status line in connection editor */
|
||||||
|
bool editor_status_line : 1;
|
||||||
|
|
||||||
|
/* Whether to ask for confirmation on saving connections with 'autoconnect=yes' */
|
||||||
|
bool editor_save_confirmation : 1;
|
||||||
|
|
||||||
union {
|
union {
|
||||||
const NmcConfig nmc_config;
|
const NmcConfig nmc_config;
|
||||||
NmcConfig nmc_config_mutable;
|
NmcConfig nmc_config_mutable;
|
||||||
};
|
};
|
||||||
char *required_fields; /* Required fields in output: '--fields' option */
|
|
||||||
|
|
||||||
char *palette_buffer; /* Buffer with sequences for terminal-colors.d(5)-based coloring. */
|
/* Required fields in output: '--fields' option */
|
||||||
|
char *required_fields;
|
||||||
|
|
||||||
|
/* Buffer with sequences for terminal-colors.d(5)-based coloring. */
|
||||||
|
char *palette_buffer;
|
||||||
|
|
||||||
GPtrArray *offline_connections;
|
GPtrArray *offline_connections;
|
||||||
} NmCli;
|
} NmCli;
|
||||||
@@ -186,14 +239,17 @@ typedef struct _NMCCommand {
|
|||||||
void (*func)(const struct _NMCCommand *cmd, NmCli *nmc, int argc, const char *const *argv);
|
void (*func)(const struct _NMCCommand *cmd, NmCli *nmc, int argc, const char *const *argv);
|
||||||
void (*usage)(void);
|
void (*usage)(void);
|
||||||
|
|
||||||
bool needs_client : 1; /* Ensure a client instance is there before calling
|
/* Ensure a client instance is there before calling the handler (unless --offline has been given). */
|
||||||
* the handler (unless --offline has been given). */
|
bool needs_client : 1;
|
||||||
bool needs_nm_running : 1; /* Client instance exists *and* the service is
|
|
||||||
* actually present on the bus. */
|
/* Client instance exists *and* the service is actually present on the bus. */
|
||||||
bool supports_offline : 1; /* Run the handler without a client even if the
|
bool needs_nm_running : 1;
|
||||||
* comand usually requires one if --offline option was used. */
|
|
||||||
bool needs_offline_conn : 1; /* With --online, read in a keyfile from
|
/* Run the handler without a client even if the comand usually requires one if --offline option was used. */
|
||||||
* standard input before dispatching the handler. */
|
bool supports_offline : 1;
|
||||||
|
|
||||||
|
/* With --online, read in a keyfile from standard input before dispatching the handler. */
|
||||||
|
bool needs_offline_conn : 1;
|
||||||
} NMCCommand;
|
} NMCCommand;
|
||||||
|
|
||||||
void nmc_command_func_agent(const NMCCommand *cmd, NmCli *nmc, int argc, const char *const *argv);
|
void nmc_command_func_agent(const NMCCommand *cmd, NmCli *nmc, int argc, const char *const *argv);
|
||||||
|
Reference in New Issue
Block a user