]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/rados: support more --format options
authorKefu Chai <kchai@redhat.com>
Wed, 2 Dec 2015 08:02:14 +0000 (16:02 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 25 Feb 2016 04:40:17 +0000 (12:40 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/tools/rados/rados.cc

index fb4967f7579977c1f2641b6048d832b145bee737..1538ee27527d2b1c40515b98eb80e123a4b49d66 100644 (file)
@@ -1407,11 +1407,8 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
   i = opts.find("format");
   if (i != opts.end()) {
     const char *format = i->second.c_str();
-    if (strcmp(format, "xml") == 0)
-      formatter = new XMLFormatter(pretty_format);
-    else if (strcmp(format, "json") == 0)
-      formatter = new JSONFormatter(pretty_format);
-    else {
+    formatter = Formatter::create(format);
+    if (!formatter) {
       cerr << "unrecognized format: " << format << std::endl;
       return -EINVAL;
     }