]> git.stg.codes - stg.git/blobdiff - projects/sgconf/main.cpp
Added XML pretty-printer.
[stg.git] / projects / sgconf / main.cpp
index 3280e336494e632f3178498a9057a90c3404a07c..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);
@@ -1240,7 +1251,7 @@ SGCONF::OPTION_BLOCK & block = blocks.Add("Connection options")
       .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::MakeConfAction(), "\t\tmake raw XML request")
+      .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())