aboutsummaryrefslogtreecommitdiff
path: root/bpkg/help.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-11-25 09:19:19 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-11-25 09:19:19 +0200
commit87e476cf192b70c133a1bf00efa8586348326092 (patch)
tree88d70237857ceec7416c8edd7a3d8cf2d8093fb5 /bpkg/help.cxx
parentb244bc6ef9d36d651c40de818ef33246919fc859 (diff)
New command line help setup
Diffstat (limited to 'bpkg/help.cxx')
-rw-r--r--bpkg/help.cxx55
1 files changed, 6 insertions, 49 deletions
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 [<command>|<topic>]" << endl
- << " bpkg [<common-options>] <command> [<command-options>] " <<
- "[<command-args>]" << 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 << "'" <<