aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-03-22 14:01:39 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-03-22 14:01:39 +0000
commit6120e9e4b11c4c35c25114a2d985630a973df62b (patch)
tree4e0a7b12f7790762eac277f63dd091ce19c9e02c
parent7f12b80981c56c2c3f25fa096ecc0fd04d245182 (diff)
downloadpaludis-6120e9e4b11c4c35c25114a2d985630a973df62b.tar.gz
paludis-6120e9e4b11c4c35c25114a2d985630a973df62b.tar.xz
Require at least one arg for cave match
-rw-r--r--src/clients/cave/cmd_match.cc11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/clients/cave/cmd_match.cc b/src/clients/cave/cmd_match.cc
index 566920a..11e58fd 100644
--- a/src/clients/cave/cmd_match.cc
+++ b/src/clients/cave/cmd_match.cc
@@ -80,7 +80,7 @@ namespace
MatchCommandLine() :
match_options(this)
{
- add_usage_line("spec [ pattern ... ]");
+ add_usage_line("spec pattern ...");
}
};
@@ -316,8 +316,8 @@ MatchCommand::run(
return EXIT_SUCCESS;
}
- if (cmdline.begin_parameters() == cmdline.end_parameters())
- throw args::DoHelp("match requires at least one parameter");
+ if (capped_distance(cmdline.begin_parameters(), cmdline.end_parameters(), 2) < 2)
+ throw args::DoHelp("match requires at least two parameters");
PackageDepSpec spec(parse_user_package_dep_spec(*cmdline.begin_parameters(), env.get(), UserPackageDepSpecOptions()));
@@ -365,7 +365,7 @@ MatchCommand::run_hosted(
(*i)->accept(m);
}
- bool any(false), all(true), none(true);;
+ bool any(false), all(true);
for (std::list<std::string>::const_iterator t(texts.begin()), t_end(texts.end()) ;
t != t_end ; ++t)
{
@@ -377,10 +377,9 @@ MatchCommand::run_hosted(
any = any || current;
all = all && current;
- none = false;
}
- return match_options.a_and.specified() ? all : (any || none);
+ return match_options.a_and.specified() ? all : any;
}
std::tr1::shared_ptr<args::ArgsHandler>