aboutsummaryrefslogtreecommitdiff
path: root/src/clients/cave/cmd_print_commands.cc
diff options
context:
space:
mode:
authorAvatar Saleem Abdulrasool <compnerd@compnerd.org> 2008-11-16 20:43:14 -0800
committerAvatar David Leverton <levertond@googlemail.com> 2008-11-17 21:53:24 +0000
commitb3c0daf8d515b414c7089908ea26ce842be01560 (patch)
treec880631b1b8662e2386d6e9386c2aee18e4d7e1f /src/clients/cave/cmd_print_commands.cc
parent15f1ce1eef979e22d35241a2c0d266d5bda4e754 (diff)
downloadpaludis-b3c0daf8d515b414c7089908ea26ce842be01560.tar.gz
paludis-b3c0daf8d515b414c7089908ea26ce842be01560.tar.xz
add --help option to commands
add a CaveCommandCommandLine base class. This class contains a --help option for cave commands.
Diffstat (limited to 'src/clients/cave/cmd_print_commands.cc')
-rw-r--r--src/clients/cave/cmd_print_commands.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/clients/cave/cmd_print_commands.cc b/src/clients/cave/cmd_print_commands.cc
index 35262e4b8..9c25b90d1 100644
--- a/src/clients/cave/cmd_print_commands.cc
+++ b/src/clients/cave/cmd_print_commands.cc
@@ -27,6 +27,8 @@
#include <algorithm>
#include <set>
+#include "command_command_line.hh"
+
using namespace paludis;
using namespace cave;
using std::cout;
@@ -35,7 +37,7 @@ using std::endl;
namespace
{
struct PrintCommandsCommandLine :
- args::ArgsHandler
+ CaveCommandCommandLine
{
virtual std::string app_name() const
{
@@ -69,6 +71,12 @@ PrintCommandsCommand::run(
PrintCommandsCommandLine cmdline;
cmdline.run(args, "CAVE", "CAVE_PRINT_COMMANDS_OPTIONS", "CAVE_PRINT_COMMANDS_CMDLINE");
+ if (cmdline.a_help.specified())
+ {
+ cout << cmdline;
+ return EXIT_SUCCESS;
+ }
+
if (cmdline.begin_parameters() != cmdline.end_parameters())
throw args::DoHelp("print-commands takes no parameters");