diff options
-rw-r--r-- | eurephiadm/commands.h | 2 | ||||
-rw-r--r-- | eurephiadm/commands/edit_config.c | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/eurephiadm/commands.h b/eurephiadm/commands.h index 95ae9cf..5b0995e 100644 --- a/eurephiadm/commands.h +++ b/eurephiadm/commands.h @@ -67,7 +67,7 @@ static const eurephiadm_functions cmdline_functions[] = { {"show-configfile", 0, NULL, NULL, "List only config file settings", NULL, cmd_ShowCfg}, - {"config", 1, "config", "[-s|-d] <key>", + {"config", 1, "config", "[-s|-d] <key> [<val>] | [-l]", "Add, delete or show one config setting", help_EditConfig, cmd_EditConfig}, // End of records marker diff --git a/eurephiadm/commands/edit_config.c b/eurephiadm/commands/edit_config.c index 2cfd129..0bf7d4d 100644 --- a/eurephiadm/commands/edit_config.c +++ b/eurephiadm/commands/edit_config.c @@ -43,6 +43,7 @@ void help_EditConfig() { " have been granted 'config' access.\n\n"); printf(" The following arguments are accepted:\n" + " -l | --list List all parameters in db\n" " -s | --set <key> <value> Add/change a parameter.\n" " -D | --delete <key> Remove the parameter.\n" "\n" @@ -53,11 +54,15 @@ void help_EditConfig() { printf(" The command will exit with exit code 0 on success.\n\n"); } +// Reusing this function for the --list argument +int cmd_ShowCfg(eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *cfg, int argc, char **argv); + int cmd_EditConfig(eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *cfg, int argc, char **argv) { int rc = 0, i = 0; e_options editargs[] = { {"--set", "-s", 2}, {"--delete", "-D", 1}, + {"--list", "-l", 0}, {"--help", "-h", 0}, {NULL, NULL, 0} }; @@ -79,6 +84,10 @@ int cmd_EditConfig(eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *cfg, rc = eDBadminConfigDelete(ctx, optargs[0]); break; + case 'l': + cmd_ShowCfg(ctx, NULL, NULL, 0, NULL); + return 0; + case 'h': help_EditConfig(); |