# # # patch "cmd.cc" # from [3df0d29e452cececbda5fac1b662adf6dc084e85] # to [ea6e5fc6bace3d9e9e83de97857ca3deae00ee27] # # patch "cmd.hh" # from [944525f2abd7d1d9fdce5e48eb35e8e91fbc1809] # to [03edc7b9874c2c35951735d7dd76ab7e89fac7c9] # # patch "commands.cc" # from [36e4666430055a87eb0d71e709e21ac623489d90] # to [a8252add69f2ed2ed88512fb21e23939deb45b46] # # patch "commands.hh" # from [31506ab303271d2cde7f9070476439e2027c7480] # to [17323d9bc503702bd9a24c927f4200a99a6625ef] # # patch "monotone.cc" # from [1e9370a6b541ef2ffdd175cde43a60afbab0d276] # to [dc002c1cf57bd83c95abc9deb703faa373ed52eb] # # patch "options_list.hh" # from [a97ca4e2e92c85a109a6b73f83d2e5f0c8c80cc9] # to [fe3b7714d2c58e05d75fefc8d28bbe5935d22051] # ============================================================ --- cmd.cc 3df0d29e452cececbda5fac1b662adf6dc084e85 +++ cmd.cc ea6e5fc6bace3d9e9e83de97857ca3deae00ee27 @@ -143,6 +143,7 @@ namespace commands { } static void explain_children(command::children_set const & children, + bool show_hidden_commands, ostream & out) { I(!children.empty()); @@ -155,7 +156,7 @@ namespace commands { { command const * child = *i; - if (child->hidden()) + if (child->hidden() && !show_hidden_commands) continue; size_t len = display_width(join_words(child->names(), ", ")) + @@ -173,7 +174,7 @@ namespace commands { { command const * child = *i; describe(join_words(child->names(), ", ")(), child->abstract(), - join_words(child->subcommands(), ", ")(), + join_words(child->subcommands(show_hidden_commands), ", ")(), colabstract, out); } } @@ -190,7 +191,9 @@ namespace commands { return cmd; } - static void explain_cmd_usage(command_id const & ident, ostream & out) + static void explain_cmd_usage(command_id const & ident, + bool show_hidden_commands, + ostream & out) { I(ident.size() >= 1); @@ -233,7 +236,7 @@ namespace commands { // Explain children, if any. if (!cmd->is_leaf()) { - explain_children(cmd->children(), out); + explain_children(cmd->children(), show_hidden_commands, out); out << '\n'; } @@ -259,14 +262,18 @@ namespace commands { } } - void explain_usage(command_id const & ident, ostream & out) + void explain_usage(command_id const & ident, + bool show_hidden_commands, + ostream & out) { command const * cmd = find_command(ident); if (ident.empty()) { out << format_text(F("Command groups:")) << "\n\n"; - explain_children(CMD_REF(__root__)->children(), out); + explain_children(CMD_REF(__root__)->children(), + show_hidden_commands, + out); out << '\n' << format_text(F("For information on a specific command, type " "'mtn help [subcommand_name ...]'.")) @@ -280,7 +287,7 @@ namespace commands { << "\n"; } else - explain_cmd_usage(ident, out); + explain_cmd_usage(ident, show_hidden_commands, out); } options::options_type command_options(command_id const & ident) @@ -386,7 +393,7 @@ CMD_NO_WORKSPACE(help, "help", "", CMD_R N_("command [ARGS...]"), N_("Displays help about commands and options"), "", - options::opts::none) + options::opts::show_hidden_commands) { if (args.size() < 1) { ============================================================ --- cmd.hh 944525f2abd7d1d9fdce5e48eb35e8e91fbc1809 +++ cmd.hh 03edc7b9874c2c35951735d7dd76ab7e89fac7c9 @@ -76,7 +76,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; + virtual names_set subcommands(bool hidden) const; options::options_type const & opts(void) const; bool use_workspace_options(void) const; children_set & children(void); ============================================================ --- commands.cc 36e4666430055a87eb0d71e709e21ac623489d90 +++ commands.cc a8252add69f2ed2ed88512fb21e23939deb45b46 @@ -183,14 +183,14 @@ namespace commands } command::names_set - command::subcommands(void) const + command::subcommands(bool hidden) const { names_set set; init_children(); for (children_set::const_iterator i = m_children.begin(); i != m_children.end(); i++) { - if ((*i)->hidden()) + if ((*i)->hidden() && !hidden) continue; names_set const & other = (*i)->names(); set.insert(other.begin(), other.end()); @@ -330,6 +330,8 @@ namespace commands return matches; } + // while we list hidden commands with a special option, + // we never want to give them as possible completions if (!child->hidden() && prefix().length() < (*iter2)().length() && allow_completion() && completion_ok) ============================================================ --- commands.hh 31506ab303271d2cde7f9070476439e2027c7480 +++ commands.hh 17323d9bc503702bd9a24c927f4200a99a6625ef @@ -23,7 +23,7 @@ namespace commands { typedef std::vector< utf8 > command_id; command_id make_command_id(std::string const & path); - void explain_usage(command_id const & cmd, std::ostream & out); + void explain_usage(command_id const & cmd, bool show_hidden, std::ostream & out); command_id complete_command(args_vector const & args); void process(app_state & app, command_id const & ident, args_vector const & args); ============================================================ --- monotone.cc 1e9370a6b541ef2ffdd175cde43a60afbab0d276 +++ monotone.cc dc002c1cf57bd83c95abc9deb703faa373ed52eb @@ -343,7 +343,9 @@ cpp_main(int argc, char ** argv) usage_stream << get_usage_str(cmd_options, app.opts); } - commands::explain_usage(u.which, usage_stream); + commands::explain_usage(u.which, + app.opts.show_hidden_commands, + usage_stream); if (app.opts.help) return 0; else ============================================================ --- options_list.hh a97ca4e2e92c85a109a6b73f83d2e5f0c8c80cc9 +++ options_list.hh fe3b7714d2c58e05d75fefc8d28bbe5935d22051 @@ -353,6 +353,14 @@ GOPT(help, "help,h", bool, false, gettex } #endif +OPT(show_hidden_commands, "hidden", bool, false, + gettext_noop("show hidden commands")) +#ifdef option_bodies +{ + show_hidden_commands = true; +} +#endif + OPTVAR(include, args_vector, include_patterns, ) OPTION(include, include, true, "include", gettext_noop("include anything described by its argument")) @@ -737,8 +745,8 @@ OPT(use_one_changelog, "use-one-changelo use_one_changelog = true; } #endif - -OPT(authors_file, "authors-file", system_path, , + +OPT(authors_file, "authors-file", system_path, , gettext_noop("file mapping author names from original to new values")) #ifdef option_bodies { @@ -746,7 +754,7 @@ OPT(authors_file, "authors-file", system } #endif -OPT(branches_file, "branches-file", system_path, , +OPT(branches_file, "branches-file", system_path, , gettext_noop("file mapping branch names from original to new values ")) #ifdef option_bodies { @@ -754,7 +762,7 @@ OPT(branches_file, "branches-file", syst } #endif -OPT(refs, "refs", std::set, , +OPT(refs, "refs", std::set, , gettext_noop("include git refs for 'revs', 'roots' or 'leaves'")) #ifdef option_bodies {