]> git.stg.codes - stg.git/blobdiff - projects/sgconf/main.cpp
Added XML pretty-printer.
[stg.git] / projects / sgconf / main.cpp
index a0ef89a1e632171c3ba977a32bc3dc4d96ce22bf..2d39cb2cde282e953229cf94e4b9a9a07b6d4b27 100644 (file)
@@ -23,6 +23,7 @@
 #include "common_sg.h"
 #include "sg_error_codes.h"
 
+#include "xml.h"
 #include "options.h"
 #include "actions.h"
 #include "config.h"
@@ -134,6 +135,16 @@ array[pos] = value;
 return true;
 }
 
+void RawXMLCallback(bool result, const std::string & reason, const std::string & response, void * data)
+{
+if (!result)
+    {
+    std::cerr << "Failed to get raw XML response. Reason: '" << reason << "'." << std::endl;
+    return;
+    }
+PrintXML(response);
+}
+
 void Usage();
 void UsageAll();
 void UsageImpl(bool full);
@@ -1239,6 +1250,14 @@ SGCONF::OPTION_BLOCK & block = blocks.Add("Connection options")
       .Add("u", "username", SGCONF::MakeParamAction(config.userName, std::string("admin"), "<username>"), "\tadministrative login")
       .Add("w", "userpass", SGCONF::MakeParamAction(config.userPass, "<password>"), "\tpassword for the administrative login")
       .Add("a", "address", SGCONF::MakeParamAction(config, "<connection string>"), "connection params as a single string in format: <login>:<password>@<host>:<port>");
+blocks.Add("Raw XML")
+      .Add("r", "raw", SGCONF::MakeFunc1Action(), "\t\tmake raw XML request")
+/*blocks.Add("Admins management options")
+      .Add("get-admins", SGCONF::MakeConfAction())
+      .Add("get-admin", SGCONF::MakeConfAction())
+      .Add("add-admin", SGCONF::MakeConfAction())
+      .Add("del-admin", SGCONF::MakeConfAction())
+      .Add("chg-admin", SGCONF::MakeConfAction());*/
 
 
 SGCONF::PARSER_STATE state(false, argc, argv);