diff options
author | 2010-08-14 10:53:38 +0100 | |
---|---|---|
committer | 2010-08-14 10:53:38 +0100 | |
commit | 5d2032ca1d69213ad44445d6b253f23b44a218ab (patch) | |
tree | 668072d881c2d6103794a268a4c68a3b901511d4 | |
parent | 09fe964e1286f2dc6c42d3fd5ca1189a5e0ba1de (diff) | |
download | paludis-5d2032ca1d69213ad44445d6b253f23b44a218ab.tar.gz paludis-5d2032ca1d69213ad44445d6b253f23b44a218ab.tar.xz |
cave find-candidates --visible
-rw-r--r-- | src/clients/cave/cmd_find_candidates.cc | 30 | ||||
-rw-r--r-- | src/clients/cave/cmd_search_cmdline.cc | 1 | ||||
-rw-r--r-- | src/clients/cave/cmd_search_cmdline.hh | 1 |
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 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<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 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; }; |