From 6f1653a6d579ea823c343e44e641641decb0750e Mon Sep 17 00:00:00 2001 From: Christophe Courtaut Date: Mon, 8 Jul 2013 11:40:20 +0200 Subject: [PATCH] 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 --- src/rgw/rgw_main.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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; -- 2.47.3