aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Stephen P. Bennett <spb@exherbo.org> 2008-03-04 12:55:32 +0000
committerAvatar Stephen P. Bennett <spb@exherbo.org> 2008-03-04 12:55:32 +0000
commit0b7747c4f5df3f1e4968f443fb2044f8f1192498 (patch)
tree7eac865378a01c098ea892f38745c5cbf0412402
parentd280fe7e6c57c31329d3623910dad02da3caaa42 (diff)
downloadpaludis-0b7747c4f5df3f1e4968f443fb2044f8f1192498.tar.gz
paludis-0b7747c4f5df3f1e4968f443fb2044f8f1192498.tar.xz
Allow hidden alias arguments that don't appear in help
-rw-r--r--paludis/args/args_dumper.cc3
-rw-r--r--paludis/args/args_option.cc4
-rw-r--r--paludis/args/args_option.hh13
-rw-r--r--paludis/args/install_args_group.cc3
-rw-r--r--paludis/args/install_args_group.hh1
-rw-r--r--paludis/args/man.cc4
6 files changed, 23 insertions, 5 deletions
diff --git a/paludis/args/args_dumper.cc b/paludis/args/args_dumper.cc
index d1d96ed..ce142a1 100644
--- a/paludis/args/args_dumper.cc
+++ b/paludis/args/args_dumper.cc
@@ -103,6 +103,7 @@ ArgsDumper::visit(const IntegerArg & a)
void
ArgsDumper::visit(const AliasArg & a)
{
- generic_visit(a);
+ if(!a.hidden())
+ generic_visit(a);
}
diff --git a/paludis/args/args_option.cc b/paludis/args/args_option.cc
index 4099a42..e3718a9 100644
--- a/paludis/args/args_option.cc
+++ b/paludis/args/args_option.cc
@@ -97,9 +97,9 @@ SwitchArg::~SwitchArg()
{
}
-AliasArg::AliasArg(ArgsOption * const o, const std::string & our_long_name) :
+AliasArg::AliasArg(ArgsOption * const o, const std::string & our_long_name, bool is_hidden) :
ArgsOption(o->group(), our_long_name, '\0', "Alias for --" + o->long_name()),
- _other(o)
+ _other(o), _hidden(is_hidden)
{
o->group()->handler()->add_option(o, our_long_name);
}
diff --git a/paludis/args/args_option.hh b/paludis/args/args_option.hh
index 04e9fca..1d4a8aa 100644
--- a/paludis/args/args_option.hh
+++ b/paludis/args/args_option.hh
@@ -327,12 +327,13 @@ namespace paludis
{
private:
ArgsOption * const _other;
+ bool _hidden;
public:
/**
* Constructor.
*/
- AliasArg(ArgsOption * const other, const std::string & new_long_name);
+ AliasArg(ArgsOption * const other, const std::string & new_long_name, bool is_hidden = false);
virtual bool specified() const
{
@@ -344,6 +345,16 @@ namespace paludis
_other->set_specified(value);
}
+ virtual bool hidden() const
+ {
+ return _hidden;
+ }
+
+ virtual void set_hidden(const bool value)
+ {
+ _hidden = value;
+ }
+
/**
* Fetch our associated option.
*/
diff --git a/paludis/args/install_args_group.cc b/paludis/args/install_args_group.cc
index 9da8d29..1497783 100644
--- a/paludis/args/install_args_group.cc
+++ b/paludis/args/install_args_group.cc
@@ -66,7 +66,8 @@ InstallArgsGroup::InstallArgsGroup(ArgsHandler * h, const std::string & our_name
("if-satisfied", "If remaining packages' dependencies are satisfied")
("if-independent", "If independent of failed and skipped packages")
("always", "Always (UNSAFE)"),
- "if-fetch-only")
+ "if-fetch-only"),
+ a_continue_on_eroyf(&a_continue_on_failure, "continue-on-eroyf", true)
{
}
diff --git a/paludis/args/install_args_group.hh b/paludis/args/install_args_group.hh
index 1221154..946dc9f 100644
--- a/paludis/args/install_args_group.hh
+++ b/paludis/args/install_args_group.hh
@@ -100,6 +100,7 @@ namespace paludis
/// --continue-on-failure
paludis::args::EnumArg a_continue_on_failure;
+ paludis::args::AliasArg a_continue_on_eroyf;
/// }
diff --git a/paludis/args/man.cc b/paludis/args/man.cc
index a4163b1..69e995d 100644
--- a/paludis/args/man.cc
+++ b/paludis/args/man.cc
@@ -20,6 +20,7 @@
#include "man.hh"
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/tr1_functional.hh>
+#include <paludis/util/visitor_cast.hh>
#include <ostream>
#include <sstream>
#include <algorithm>
@@ -114,6 +115,9 @@ paludis::args::generate_doc(DocWriter & dw, const ArgsHandler * const h)
for (paludis::args::ArgsGroup::ConstIterator b((*a)->begin()), b_end((*a)->end()) ;
b != b_end ; ++b)
{
+ if (visitor_cast<const paludis::args::AliasArg>(**b) && visitor_cast<const paludis::args::AliasArg>(**b)->hidden())
+ continue;
+
dw.arg_group_item((*b)->short_name(), (*b)->long_name(),
(*b)->can_be_negated() ? "no-" + (*b)->long_name() : "", (*b)->description());