about summary refs log tree commit diff
path: root/clients/cli/nmcli.h
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2018-07-03 23:54:48 +0200
committerMichael Biebl <biebl@debian.org>2018-07-03 23:54:48 +0200
commit54de7f04d1fac5f29fd54ec4120ba2fc4f9b5714 (patch)
tree87729385ff8de744dc44d0b4cc75916494b2fd38 /clients/cli/nmcli.h
parent680d3db45106e7a18665a366e1b57e58cef61506 (diff)
parent329b15110c4b183d7a47552abe3a6a6ff933e817 (diff)
Merge branch 'experimental'
Diffstat (limited to 'clients/cli/nmcli.h')
-rw-r--r--clients/cli/nmcli.h42
1 files changed, 22 insertions, 20 deletions
diff --git a/clients/cli/nmcli.h b/clients/cli/nmcli.h
index 874bca21..bcf1c01b 100644
--- a/clients/cli/nmcli.h
+++ b/clients/cli/nmcli.h
@@ -14,23 +14,16 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Copyright 2010 - 2017 Red Hat, Inc.
+ * Copyright 2010 - 2018 Red Hat, Inc.
  */
 
 #ifndef NMC_NMCLI_H
 #define NMC_NMCLI_H
 
-#include "NetworkManager.h"
 #include "nm-secret-agent-old.h"
-
 #include "nm-meta-setting-desc.h"
 
-#if WITH_POLKIT_AGENT
-#include "nm-polkit-listener.h"
-#else
-/* polkit agent is not available; define fake NMPolkitListener */
-typedef gpointer NMPolkitListener;
-#endif
+struct _NMPolkitListener;
 
 typedef char *(*NmcCompEntryFunc) (const char *, int);
 
@@ -79,6 +72,14 @@ typedef enum {
 	NMC_PRINT_PRETTY = 2
 } NMCPrintOutput;
 
+static inline NMMetaAccessorGetType
+nmc_print_output_to_accessor_get_type (NMCPrintOutput print_output)
+{
+	return   (print_output != NMC_PRINT_TERSE)
+	       ? NM_META_ACCESSOR_GET_TYPE_PRETTY
+	       : NM_META_ACCESSOR_GET_TYPE_PARSABLE;
+}
+
 /* === Output fields === */
 
 typedef enum {
@@ -100,23 +101,18 @@ struct _NmcOutputField {
 	gboolean value_is_array;        /* Whether value is char** instead of char* */
 	gboolean free_value;            /* Whether to free the value */
 	NmcOfFlags flags;               /* Flags - whether and how to print values/field names/headers */
-	NMMetaTermColor color;             /* Use this color to print value */
-	NMMetaTermFormat color_fmt;        /* Use this terminal format to print value */
+	NMMetaColor color;              /* Use this color to print value */
 };
 
-typedef enum {
-	NMC_USE_COLOR_AUTO,
-	NMC_USE_COLOR_YES,
-	NMC_USE_COLOR_NO,
-} NmcColorOption;
-
 typedef struct _NmcConfig {
 	NMCPrintOutput print_output;                      /* Output mode */
-	NmcColorOption use_colors;                        /* Whether to use colors for output: option '--color' */
+	gboolean use_colors;                              /* Whether to use colors for output: option '--color' */
 	bool multiline_output;                            /* Multiline output instead of default tabular */
 	bool escape_values;                               /* Whether to escape ':' and '\' in terse tabular mode */
 	bool in_editor;                                   /* Whether running the editor - nmcli con edit' */
 	bool show_secrets;                                /* Whether to display secrets (both input and output): option '--show-secrets' */
+	bool overview;                                    /* Overview mode (hide default values) */
+	const char *palette[_NM_META_COLOR_NUM];          /* Color palette */
 } NmcConfig;
 
 typedef struct _NmcOutputData {
@@ -135,7 +131,7 @@ typedef struct _NmCli {
 
 	NMSecretAgentOld *secret_agent;                   /* Secret agent */
 	GHashTable *pwds_hash;                            /* Hash table with passwords in passwd-file */
-	NMPolkitListener *pk_listener ;                   /* polkit agent listener */
+	struct _NMPolkitListener *pk_listener;            /* polkit agent listener */
 
 	int should_wait;                                  /* Semaphore indicating whether nmcli should not end or not yet */
 	gboolean nowait_flag;                             /* '--nowait' option; used for passing to callbacks */
@@ -149,9 +145,15 @@ typedef struct _NmCli {
 	gboolean complete;                                /* Autocomplete the command line */
 	gboolean editor_status_line;                      /* Whether to display status line in connection editor */
 	gboolean editor_save_confirmation;                /* Whether to ask for confirmation on saving connections with 'autoconnect=yes' */
-	NMMetaTermColor editor_prompt_color;              /* Color of prompt in connection editor */
+
+	char *palette_buffer;                             /* Buffer with sequences for terminal-colors.d(5)-based coloring. */
 } NmCli;
 
+#define NMC_RETURN(nmc, rvalue) \
+	G_STMT_START { \
+		return ((nmc)->return_value = (rvalue)); \
+	} G_STMT_END
+
 extern NmCli nm_cli;
 
 /* Error quark for GError domain */