]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Add --help support to radosgw 406/head
authorChristophe Courtaut <christophe.courtaut@gmail.com>
Mon, 8 Jul 2013 09:40:20 +0000 (11:40 +0200)
committerChristophe Courtaut <christophe.courtaut@gmail.com>
Mon, 8 Jul 2013 09:40:20 +0000 (11:40 +0200)
http://tracker.ceph.com/issues/3074 fixes #3074

The support of --help option is added through this patch.
By now, it displays the generic options usage used in radosgw.

Signed-off-by: Christophe Courtaut <christophe.courtaut@gmail.com>
src/rgw/rgw_main.cc

index c1f48579f9a883e703208c338ba5d655ad273f91..8b127762d623c7eced193b60959ba8f3b38c411c 100644 (file)
@@ -394,6 +394,14 @@ public:
   }
 };
 
+int usage()
+{
+  cerr << "usage: radosgw [options...]" << std::endl;
+  cerr << "options:\n";
+  generic_server_usage();
+  return 0;
+}
+
 /*
  * start up the RADOS connection and then handle HTTP messages as they come in
  */
@@ -421,6 +429,13 @@ int main(int argc, const char **argv)
   global_init(&def_args, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_DAEMON,
              CINIT_FLAG_UNPRIVILEGED_DAEMON_DEFAULTS);
 
+  for (std::vector<const char*>::iterator i = args.begin(); i != args.end(); ) {
+    if (ceph_argparse_flag(args, i, "-h", "--help", (char*)NULL)) {
+      usage();
+      return 0;
+    }
+  }
+
   if (g_conf->daemonize) {
     if (g_conf->rgw_socket_path.empty() and g_conf->rgw_port.empty()) {
       cerr << "radosgw: must specify 'rgw socket path' or 'rgw port' to run as a daemon" << std::endl;