From: Christophe Courtaut Date: Mon, 8 Jul 2013 09:40:20 +0000 (+0200) Subject: rgw: Add --help support to radosgw X-Git-Tag: v0.67-rc1~128^2~6^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6f1653a6d579ea823c343e44e641641decb0750e;p=ceph.git rgw: Add --help support to radosgw 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 --- diff --git a/src/rgw/rgw_main.cc b/src/rgw/rgw_main.cc index c1f48579f9a8..8b127762d623 100644 --- a/src/rgw/rgw_main.cc +++ b/src/rgw/rgw_main.cc @@ -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::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;