aboutsummaryrefslogtreecommitdiff
path: root/paludis/args/args_visitor.cc
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2011-05-02 21:55:05 +0100
committerAvatar David Leverton <levertond@googlemail.com> 2011-05-02 21:55:05 +0100
commitd22eca8b4565f8180c28d3b37618f3ea3a0b7f6e (patch)
treedaa9e6320814e1346072dbcebf77448818332699 /paludis/args/args_visitor.cc
parente48586fdc72b4c95df114a9ba1ccecae4418ef7b (diff)
downloadpaludis-d22eca8b4565f8180c28d3b37618f3ea3a0b7f6e.tar.gz
paludis-d22eca8b4565f8180c28d3b37618f3ea3a0b7f6e.tar.xz
Allow StringArgs to support --no-
Diffstat (limited to 'paludis/args/args_visitor.cc')
-rw-r--r--paludis/args/args_visitor.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/paludis/args/args_visitor.cc b/paludis/args/args_visitor.cc
index 700f047d3..af8ec032f 100644
--- a/paludis/args/args_visitor.cc
+++ b/paludis/args/args_visitor.cc
@@ -91,8 +91,14 @@ void ArgsVisitor::visit(StringArg & arg)
if (! _imp->env_prefix.empty())
setenv(env_name(arg.long_name()).c_str(), p.c_str(), 1);
}
- else
+ else if (! arg.can_be_negated())
throw BadArgument("--no-" + arg.long_name());
+ else
+ {
+ arg.set_specified(false);
+ if (! _imp->env_prefix.empty())
+ unsetenv(env_name(arg.long_name()).c_str());
+ }
}
void ArgsVisitor::visit(AliasArg & arg)