aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-11-08 13:55:08 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-11-08 13:55:08 +0000
commitc69512ee570dedaba90c4b21c2fb0e0413791d18 (patch)
tree1c5ccde0465c969ef7285b6ce3bb024bed1ce661
parent16ff1369105265ec6d8fcbebfbdb74f50338e908 (diff)
downloadpaludis-c69512ee570dedaba90c4b21c2fb0e0413791d18.tar.gz
paludis-c69512ee570dedaba90c4b21c2fb0e0413791d18.tar.xz
inquisitio --not
-rw-r--r--NEWS2
-rw-r--r--src/clients/inquisitio/command_line.cc1
-rw-r--r--src/clients/inquisitio/command_line.hh1
-rw-r--r--src/clients/inquisitio/do_search.cc10
4 files changed, 9 insertions, 5 deletions
diff --git a/NEWS b/NEWS
index 1da09ea..7b04919 100644
--- a/NEWS
+++ b/NEWS
@@ -8,7 +8,7 @@ trunk/:
* STILL BROKEN, wait for 0.26.0 if you use these: CRAN, Ruby bindings for
dep specs.
- * inquisitio --all-versions.
+ * inquisitio --all-versions, --not.
0.26.0_alpha3:
* STILL BROKEN, wait for 0.26.0 if you use these: CRAN, Ruby bindings for
diff --git a/src/clients/inquisitio/command_line.cc b/src/clients/inquisitio/command_line.cc
index e2493e4..d9addd1 100644
--- a/src/clients/inquisitio/command_line.cc
+++ b/src/clients/inquisitio/command_line.cc
@@ -53,6 +53,7 @@ CommandLine::CommandLine() :
"text"),
a_flatten(&match_args, "flatten", 'f', "Flatten spec trees, rather than matching against individual items"),
a_enabled_only(&match_args, "enabled-only", 'e', "When searching spec trees, only look in enabled subtrees"),
+ a_not(&match_args, "not", 'n', "Select packages that do not match"),
filter_args(this, "Filter options",
"Options that control whether or not a package is considered for matching."),
diff --git a/src/clients/inquisitio/command_line.hh b/src/clients/inquisitio/command_line.hh
index 70988ce..66be686 100644
--- a/src/clients/inquisitio/command_line.hh
+++ b/src/clients/inquisitio/command_line.hh
@@ -74,6 +74,7 @@ class CommandLine :
paludis::args::EnumArg a_matcher;
paludis::args::SwitchArg a_flatten;
paludis::args::SwitchArg a_enabled_only;
+ paludis::args::SwitchArg a_not;
///\}
diff --git a/src/clients/inquisitio/do_search.cc b/src/clients/inquisitio/do_search.cc
index 2dd6030..65534c3 100644
--- a/src/clients/inquisitio/do_search.cc
+++ b/src/clients/inquisitio/do_search.cc
@@ -114,7 +114,8 @@ namespace
const QualifiedPackageName & q,
const tr1::function<bool (const PackageID &)> & e,
const tr1::function<bool (const PackageID &)> & m,
- const bool all_versions)
+ const bool all_versions,
+ const bool invert_match)
{
tr1::shared_ptr<const PackageIDSequence> ids(r->package_ids(q));
if (ids->empty())
@@ -129,7 +130,7 @@ namespace
i != i_end ; ++i)
if (e(**i))
{
- if (m(**i))
+ if (invert_match ^ m(**i))
return *i;
else if (! all_versions)
return tr1::shared_ptr<const PackageID>();
@@ -145,13 +146,14 @@ namespace
std::pair<const QualifiedPackageName, tr1::shared_ptr<const PackageID> > & q,
const tr1::function<bool (const PackageID &)> & e,
const tr1::function<bool (const PackageID &)> & m,
- const bool all_versions)
+ const bool all_versions,
+ const bool invert_match)
{
tr1::shared_ptr<const PackageID> best_id;
for (std::list<tr1::shared_ptr<const Repository> >::const_iterator r(repos.begin()), r_end(repos.end()) ;
r != r_end ; ++r)
{
- tr1::shared_ptr<const PackageID> id(fetch_id(env, *r, q.first, e, m, all_versions));
+ tr1::shared_ptr<const PackageID> id(fetch_id(env, *r, q.first, e, m, all_versions, invert_match));
if (id)
{
if (best_id)