diff options
author | David Sommerseth <dazo@users.sourceforge.net> | 2008-12-04 11:50:45 +0100 |
---|---|---|
committer | David Sommerseth <dazo@users.sourceforge.net> | 2008-12-04 11:50:45 +0100 |
commit | e3e7ab839651cdeea4998a0de6953d0f23b2e914 (patch) | |
tree | 0737946dd5ff218741a356f9370130b94b46c37b | |
parent | 6587b3930a5190c88559a9b55b3ee0be24b800da (diff) | |
download | eurephia-e3e7ab839651cdeea4998a0de6953d0f23b2e914.tar.gz eurephia-e3e7ab839651cdeea4998a0de6953d0f23b2e914.tar.xz eurephia-e3e7ab839651cdeea4998a0de6953d0f23b2e914.zip |
config command: Added -l | --list to list all db parameters
-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(); |