From 87e476cf192b70c133a1bf00efa8586348326092 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 25 Nov 2015 09:19:19 +0200 Subject: New command line help setup --- bpkg/help.cxx | 55 ++++++------------------------------------------------- 1 file changed, 6 insertions(+), 49 deletions(-) (limited to 'bpkg/help.cxx') diff --git a/bpkg/help.cxx b/bpkg/help.cxx index 0505061..df4a286 100644 --- a/bpkg/help.cxx +++ b/bpkg/help.cxx @@ -19,64 +19,21 @@ namespace bpkg static void help () { - ostream& o (cout); - - //@@ TODO - - o << "usage: bpkg --help" << endl - << " bpkg --version" << endl - << " bpkg help [|]" << endl - << " bpkg [] [] " << - "[]" << endl - << endl; - - o << "The commands are:" << endl - << endl; - - bpkg_commands::print_short_usage (o); - o << endl; - - o << "The help topics are:" << endl - << endl; - - bpkg_topics::print_short_usage (o); - o << endl; - - o << "The common options are summarized below. Note that they can also " - "be specified" << endl - << "as part of the command-specific options." << endl - << endl; - - common_options::print_short_usage (o); - o << endl; - - o << ""<< endl; + print_bpkg_usage (cout); } int - help (const help_options&, const string& t, void (*usage) (std::ostream&)) + help (const help_options&, const string& t, usage_function* usage) { ostream& o (cout); if (usage != nullptr) // Command. - { - usage (o); - - //@@ TODO - - o << endl - << "The common options are summarized below. For details, see the " << - "'common' help" << endl - << "topic." << endl - << endl; - - common_options::print_short_usage (o); - } - else if (t.empty ()) // General help. + usage (o, cli::usage_para::none); + else if (t.empty ()) // General help. help (); - else if (t == "common") // Help topics. + else if (t == "common-options") // Help topics. { - print_bpkg_common_long_usage (cout); + print_bpkg_common_options_long_usage (cout); } else fail << "unknown bpkg command/help topic '" << t << "'" << -- cgit v1.1