From 5d2032ca1d69213ad44445d6b253f23b44a218ab Mon Sep 17 00:00:00 2001 From: Ciaran McCreesh Date: Sat, 14 Aug 2010 10:53:38 +0100 Subject: cave find-candidates --visible --- src/clients/cave/cmd_find_candidates.cc | 30 +++++++++++++++++++++++------- src/clients/cave/cmd_search_cmdline.cc | 1 + src/clients/cave/cmd_search_cmdline.hh | 1 + 3 files changed, 25 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/clients/cave/cmd_find_candidates.cc b/src/clients/cave/cmd_find_candidates.cc index 3cf1789f1..62754b51b 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 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 ids; ids = ((*env)[selection::BestVersionOnly(generator::Package(*q) | filter::SupportsAction() | filter::NotMasked())]); - if (ids->empty()) - ids = ((*env)[selection::BestVersionOnly(generator::Package(*q) | filter::SupportsAction())]); - 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())]); + 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 cdc08c5fe..bdecef740 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 153830320..437fd6c59 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; }; -- cgit v1.2.3