# # # patch "NEWS" # from [7e0c3945a6cd7f5491d2dfd6fb1ee09c4fc141f2] # to [ef0fbaeb3cdacc972f6fe052e96d1b1bed1c2ce6] # # patch "cmd.hh" # from [aab85d512e79e5dbc56f67a2c4b4bb5f3b991219] # to [100b8bb08a126fb827acfd50e104897a4ffd8f97] # # patch "commands.cc" # from [159c1be21ced0e2800d2461802f7dd4d30c9830b] # to [e21ce6ddd485cb7886581fe14be6d6b0616d3bf9] # ============================================================ --- NEWS 7e0c3945a6cd7f5491d2dfd6fb1ee09c4fc141f2 +++ NEWS ef0fbaeb3cdacc972f6fe052e96d1b1bed1c2ce6 @@ -12,6 +12,10 @@ - the "--brief" switch for mtn annotate has been renamed to "--revs-only" for clarity + - mtn help now lists the commands (and their aliases) available + within a group, so its easier to get an overview which commands + are available at all + Bugs fixed - mtn automate heads called without a branch argument now properly ============================================================ --- cmd.hh aab85d512e79e5dbc56f67a2c4b4bb5f3b991219 +++ cmd.hh 100b8bb08a126fb827acfd50e104897a4ffd8f97 @@ -73,6 +73,7 @@ namespace commands virtual std::string params(void) const; virtual std::string abstract(void) const; virtual std::string desc(void) const; + virtual names_set subcommands(void) const; options::options_type const & opts(void) const; bool use_workspace_options(void) const; children_set & children(void); ============================================================ --- commands.cc 159c1be21ced0e2800d2461802f7dd4d30c9830b +++ commands.cc e21ce6ddd485cb7886581fe14be6d6b0616d3bf9 @@ -257,6 +257,22 @@ namespace commands { { return abstract() + ".\n" + safe_gettext(m_desc().c_str()); } + + command::names_set + command::subcommands(void) const + { + names_set set; + init_children(); + for (children_set::const_iterator i = m_children.begin(); + i != m_children.end(); i++) + { + if ((*i)->hidden()) + continue; + names_set const & other = (*i)->names(); + set.insert(other.begin(), other.end()); + } + return set; + } options::options_type const & command::opts(void) const @@ -569,7 +585,8 @@ namespace commands // to start, at the very least, two spaces after the tag's end position; // this is given by the colabstract parameter. static void describe(const string & tag, const string & abstract, - size_t colabstract, ostream & out) + const string & subcommands, size_t colabstract, + ostream & out) { I(colabstract > 0); @@ -579,7 +596,12 @@ namespace commands out << string(colabstract - col, ' '); col = colabstract; - out << format_text(abstract, colabstract, col) << '\n'; + string desc(abstract); + if (subcommands.size() > 0) + { + desc += " (" + subcommands + ')'; + } + out << format_text(desc, colabstract, col) << '\n'; } static void explain_children(command::children_set const & children, @@ -610,8 +632,12 @@ namespace commands for (vector< command const * >::const_iterator i = sorted.begin(); i != sorted.end(); i++) - describe(join_words((*i)->names(), ", ")(), (*i)->abstract(), - colabstract, out); + { + command const * child = *i; + describe(join_words(child->names(), ", ")(), child->abstract(), + join_words(child->subcommands(), ", ")(), + colabstract, out); + } } static void explain_cmd_usage(command_id const & ident, ostream & out) @@ -697,13 +723,13 @@ namespace commands << format_text(F("For information on a specific command, type " "'mtn help [subcommand_name ...]'.")) << "\n\n" - << format_text(F("To see the commands available within a group, " - "type 'mtn help '.")) + << format_text(F("To see more details about the commands of a " + "particular group, type 'mtn help '.")) << "\n\n" << format_text(F("Note that you can always abbreviate a command " "name as long as it does not conflict with other " "names.")) - << "\n\n"; + << "\n"; } else explain_cmd_usage(ident, out);