summaryrefslogtreecommitdiff
path: root/server/src/macrotool.cc
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/macrotool.cc')
-rw-r--r--server/src/macrotool.cc23
1 files changed, 13 insertions, 10 deletions
diff --git a/server/src/macrotool.cc b/server/src/macrotool.cc
index 46fbc24..44beeef 100644
--- a/server/src/macrotool.cc
+++ b/server/src/macrotool.cc
@@ -31,12 +31,16 @@
// For getopt_long and friends
#include <getopt.h>
+#include <vector>
+#include <string>
+
#include "configurationparser.h"
#include "configuration.h"
#include "debug.h"
#include "macrotool_dump.h"
+#include "macrotool_fieldnames.h"
static const char version_str[] =
"Pracro server v" VERSION "\n"
@@ -62,6 +66,8 @@ static const char usage_str[] =
"\n"
"Commands:\n"
" dump entity Dumps 'entity' to screen ('dump help' to see list of entities).\n"
+" fieldnames entity Add/delete/update entries in the fieldnames database\n"
+" ('fieldnames help' to see list of entities).\n"
;
ConfigurationParser *configparser = NULL;
@@ -125,8 +131,6 @@ int main(int argc, char *argv[])
printf(usage_str, argv[0]);
exit(EXIT_FAILURE);
}
-
- std::string command = argv[optind];
if(debugstr) {
pracro_debug_parse(debugstr);
@@ -140,16 +144,15 @@ int main(int argc, char *argv[])
Conf::xml_basedir = xml_basedir;
}
- if(command == "dump") {
- optind++;
- if(optind >= argc) {
- fprintf(stderr, "Missing command parameter\n");
- printf(usage_str, argv[0]);
- exit(EXIT_FAILURE);
- }
- macrotool_dump(argv[optind]);
+ std::string command = argv[optind++];
+ std::vector<std::string> params;
+ while(optind < argc) {
+ params.push_back(argv[optind++]);
}
+ if(command == "dump") macrotool_dump(params);
+ if(command == "fieldnames") macrotool_fieldnames(params);
+
// Clean up
if(configfile) free(configfile);