aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-14 10:53:38 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-14 10:53:38 +0100
commit5d2032ca1d69213ad44445d6b253f23b44a218ab (patch)
tree668072d881c2d6103794a268a4c68a3b901511d4
parent09fe964e1286f2dc6c42d3fd5ca1189a5e0ba1de (diff)
downloadpaludis-5d2032ca1d69213ad44445d6b253f23b44a218ab.tar.gz
paludis-5d2032ca1d69213ad44445d6b253f23b44a218ab.tar.xz
cave find-candidates --visible
-rw-r--r--src/clients/cave/cmd_find_candidates.cc30
-rw-r--r--src/clients/cave/cmd_search_cmdline.cc1
-rw-r--r--src/clients/cave/cmd_search_cmdline.hh1
3 files changed, 25 insertions, 7 deletions
diff --git a/src/clients/cave/cmd_find_candidates.cc b/src/clients/cave/cmd_find_candidates.cc
index 3cf1789..62754b5 100644
--- a/src/clients/cave/cmd_find_candidates.cc
+++ b/src/clients/cave/cmd_find_candidates.cc
@@ -186,19 +186,35 @@ FindCandidatesCommand::run_hosted(
{
if (search_options.a_all_versions.specified())
{
- const std::shared_ptr<const PackageIDSequence> ids((*env)[selection::AllVersionsUnsorted(
- generator::Package(*q))]);
- check_candidates(yield, step, ids);
+ if (search_options.a_visible.specified())
+ {
+ const auto ids((*env)[selection::AllVersionsUnsorted(generator::Package(*q))]);
+ check_candidates(yield, step, ids);
+ }
+ else
+ {
+ const auto ids((*env)[selection::AllVersionsUnsorted(generator::Package(*q) | filter::NotMasked())]);
+ check_candidates(yield, step, ids);
+ }
}
else
{
std::shared_ptr<const PackageIDSequence> ids;
ids = ((*env)[selection::BestVersionOnly(generator::Package(*q) | filter::SupportsAction<InstallAction>() | filter::NotMasked())]);
- if (ids->empty())
- ids = ((*env)[selection::BestVersionOnly(generator::Package(*q) | filter::SupportsAction<InstallAction>())]);
- if (ids->empty())
- ids = ((*env)[selection::BestVersionOnly(generator::Package(*q))]);
+
+ if (search_options.a_visible.specified())
+ {
+ if (ids->empty())
+ ids = ((*env)[selection::BestVersionOnly(generator::Package(*q) | filter::NotMasked())]);
+ }
+ else
+ {
+ if (ids->empty())
+ ids = ((*env)[selection::BestVersionOnly(generator::Package(*q) | filter::SupportsAction<InstallAction>())]);
+ if (ids->empty())
+ ids = ((*env)[selection::BestVersionOnly(generator::Package(*q))]);
+ }
check_candidates(yield, step, ids);
}
diff --git a/src/clients/cave/cmd_search_cmdline.cc b/src/clients/cave/cmd_search_cmdline.cc
index cdc08c5..bdecef7 100644
--- a/src/clients/cave/cmd_search_cmdline.cc
+++ b/src/clients/cave/cmd_search_cmdline.cc
@@ -27,6 +27,7 @@ SearchCommandLineCandidateOptions::SearchCommandLineCandidateOptions(args::ArgsH
g_candidate_options(this, "Candidate Options", "Control which packages and versions are selected as "
"candidates for matching."),
a_all_versions(&g_candidate_options, "all-versions", 'a', "Search in every version of packages", true),
+ a_visible(&g_candidate_options, "visible", 'v', "Search only in visible (not masked) versions of packages", true),
a_matching(&g_candidate_options, "matching", 'm', "Search only in packages matching the supplied specification")
{
}
diff --git a/src/clients/cave/cmd_search_cmdline.hh b/src/clients/cave/cmd_search_cmdline.hh
index 1538303..437fd6c 100644
--- a/src/clients/cave/cmd_search_cmdline.hh
+++ b/src/clients/cave/cmd_search_cmdline.hh
@@ -35,6 +35,7 @@ namespace paludis
args::ArgsGroup g_candidate_options;
args::SwitchArg a_all_versions;
+ args::SwitchArg a_visible;
args::StringSetArg a_matching;
};