# # patch "monotone.cc" # from [63226eca74aeddb4edf3acc7a8c65b397e084454] # to [0719867d9645dcd2322cce26a223889d9ae4fc78] # --- monotone.cc +++ monotone.cc @@ -53,6 +53,9 @@ struct poptOption options[] = { + // Use the coptions table as well. + { NULL, 0, POPT_ARG_INCLUDE_TABLE, coptions, 0, NULL, NULL }, + {"debug", 0, POPT_ARG_NONE, NULL, OPT_DEBUG, "print debug log to stderr while running", NULL}, {"dump", 0, POPT_ARG_STRING, &argstr, OPT_DUMP, "file to dump debugging log to, on failure", NULL}, {"quiet", 0, POPT_ARG_NONE, NULL, OPT_QUIET, "suppress log and progress messages", NULL}, @@ -67,9 +70,6 @@ {"key", 'k', POPT_ARG_STRING, &argstr, OPT_KEY_NAME, "set key for signatures", NULL}, {"db", 'd', POPT_ARG_STRING, &argstr, OPT_DB_NAME, "set name of database", NULL}, {"root", 0, POPT_ARG_STRING, &argstr, OPT_ROOT, "limit search for working copy to specified root", NULL}, - - // Use the coptions table as well. - { NULL, 0, POPT_ARG_INCLUDE_TABLE, coptions, 0, "Command-specific options", NULL }, { NULL, 0, 0, NULL, 0, NULL, NULL } }; @@ -422,12 +422,14 @@ // Make sure to hide documentation that's not part of // the current command. set command_options = commands::command_options(u.which); + int count = 0; for (poptOption *o = coptions; o->val != 0; o++) { if (command_options.find(o->val) != command_options.end()) { o->argInfo &= ~POPT_ARGFLAG_DOC_HIDDEN; L(F("Removed 'hidden' from option # %d\n") % o->argInfo); + count++; } else { @@ -435,7 +437,17 @@ L(F("Added 'hidden' to option # %d\n") % o->argInfo); } } + free((void *)options[0].descrip); options[0].descrip = NULL; + if (count != 0) + { + ostringstream sstr; + sstr << "Options specific to 'monotone " << u.which << "':"; + options[0].descrip = strdup(sstr.str().c_str()); + options[0].argInfo |= POPT_ARGFLAG_DOC_HIDDEN; + L(F("Added 'hidden' to option # %d\n") % options[0].argInfo); + } + poptPrintHelp(ctx(), stdout, 0); cout << endl; commands::explain_usage(u.which, cout);