Przeglądaj źródła

Add DefaultKeys and HidePasswords options. It's not implemented yet

Serj Kalichev 1 rok temu
rodzic
commit
79d0fc3fc1
3 zmienionych plików z 20 dodań i 0 usunięć
  1. 2 0
      src/pline.h
  2. 16 0
      src/plugin.c
  3. 2 0
      xml/sysrepo.xml

+ 2 - 0
src/pline.h

@@ -120,6 +120,8 @@ typedef struct {
 	bool_t multi_keys_w_stmt;
 	bool_t colorize;
 	uint8_t indent;
+	bool_t default_keys;
+	bool_t hide_passwords;
 } pline_opts_t;
 
 

+ 16 - 0
src/plugin.c

@@ -98,6 +98,8 @@ int kplugin_sysrepo_init(kcontext_t *context)
 	udata->opts.multi_keys_w_stmt = BOOL_TRUE;
 	udata->opts.colorize = BOOL_TRUE;
 	udata->opts.indent = 2;
+	udata->opts.default_keys = BOOL_FALSE;
+	udata->opts.hide_passwords = BOOL_TRUE;
 	parse_plugin_conf(kplugin_conf(plugin), &udata->opts);
 
 	kplugin_set_udata(plugin, udata);
@@ -223,6 +225,20 @@ static int parse_plugin_conf(const char *conf, pline_opts_t *opts)
 			opts->indent = indent;
 	}
 
+	if ((val = faux_ini_find(ini, "DefaultKeys"))) {
+		if (faux_str_cmp(val, "y") == 0)
+			opts->default_keys = BOOL_TRUE;
+		else if (faux_str_cmp(val, "n") == 0)
+			opts->default_keys = BOOL_FALSE;
+	}
+
+	if ((val = faux_ini_find(ini, "HidePasswords"))) {
+		if (faux_str_cmp(val, "y") == 0)
+			opts->hide_passwords = BOOL_TRUE;
+		else if (faux_str_cmp(val, "n") == 0)
+			opts->hide_passwords = BOOL_FALSE;
+	}
+
 	faux_ini_free(ini);
 
 	return 0;

+ 2 - 0
xml/sysrepo.xml

@@ -11,6 +11,8 @@
 	MultiKeysWithStatement = y
 	Colorize = y
 	Indent = 2
+	DefaultKeys = n
+	HidePasswords = y
 </PLUGIN>