]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-conf: display arguments when an option cannot be parsed 1031/head
authorLoic Dachary <loic@dachary.org>
Wed, 1 Jan 2014 20:23:55 +0000 (21:23 +0100)
committerLoic Dachary <loic@dachary.org>
Wed, 1 Jan 2014 20:23:55 +0000 (21:23 +0100)
   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 <loic@dachary.org>
src/tools/ceph_conf.cc

index b2286f4e0944fc6c320995664b87a2e6359f3b07..14045f9f857445e7571cd84f4724474acd292b99 100644 (file)
@@ -156,6 +156,7 @@ int main(int argc, const char **argv)
 
   argv_to_vec(argc, argv, args);
   env_to_vec(args);
+  vector<const char*> 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<const char *>::iterator ci = orig_args.begin(); ci != orig_args.end(); ++ci) {
+         cerr << " '" << *ci << "'";
+       }
+       cerr << std::endl;
        usage();
        exit(1);
       }