From: Loic Dachary Date: Wed, 1 Jan 2014 20:23:55 +0000 (+0100) Subject: ceph-conf: display arguments when an option cannot be parsed X-Git-Tag: v0.77~64^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1031%2Fhead;p=ceph.git 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 --- diff --git a/src/tools/ceph_conf.cc b/src/tools/ceph_conf.cc index b2286f4e094..14045f9f857 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); }