aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-08-03 18:29:44 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-08-03 18:29:44 +0100
commiteb9015130abc4431341dacafa64555ec83debabc (patch)
treeaef9d0689bd8d388b9738e74ae1746d8b8d728be
parent44d70450c5c24e8324c6ba87a027e6cd47f86895 (diff)
downloadpaludis-eb9015130abc4431341dacafa64555ec83debabc.tar.gz
paludis-eb9015130abc4431341dacafa64555ec83debabc.tar.xz
normalise enum arg short aliases
-rw-r--r--paludis/args/args_option.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/paludis/args/args_option.cc b/paludis/args/args_option.cc
index 6df2dd2..b44786b 100644
--- a/paludis/args/args_option.cc
+++ b/paludis/args/args_option.cc
@@ -276,11 +276,12 @@ EnumArg::set_argument(const std::string & arg)
{
Context context("When handling argument '" + arg + "' for '--" + long_name() + "':");
- if (_imp->allowed_args.end() == std::find_if(_imp->allowed_args.begin(),
- _imp->allowed_args.end(), ArgIs(arg)))
+ /* if we're given the short arg, turn it magically into the long one */
+ AllowedArgConstIterator i(std::find_if(_imp->allowed_args.begin(), _imp->allowed_args.end(), ArgIs(arg)));
+ if (i == _imp->allowed_args.end())
throw (BadValue("--" + long_name(), arg));
- _argument = arg;
+ _argument = i->long_name();
}
void