From 229740f42245dad46dbbdd5710650226fe7bf168 Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Wed, 1 Jan 2014 21:23:55 +0100 Subject: [PATCH] ceph-conf: display arguments when an option cannot be parsed unable to parse option: '' Is difficult to figure out. It is much better if shown in the context in which it was found: ceph-conf --help '' unable to parse option: '' args: '--help' '' Signed-off-by: Loic Dachary --- src/tools/ceph_conf.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tools/ceph_conf.cc b/src/tools/ceph_conf.cc index b2286f4e0944f..14045f9f85744 100644 --- a/src/tools/ceph_conf.cc +++ b/src/tools/ceph_conf.cc @@ -156,6 +156,7 @@ int main(int argc, const char **argv) argv_to_vec(argc, argv, args); env_to_vec(args); + vector orig_args = args; global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_DAEMON, CINIT_FLAG_NO_DAEMON_ACTIONS); @@ -202,6 +203,11 @@ int main(int argc, const char **argv) lookup_key = *i++; } else { cerr << "unable to parse option: '" << *i << "'" << std::endl; + cerr << "args:"; + for (std::vector::iterator ci = orig_args.begin(); ci != orig_args.end(); ++ci) { + cerr << " '" << *ci << "'"; + } + cerr << std::endl; usage(); exit(1); } -- 2.39.5