aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-14 11:08:31 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-14 11:08:31 +0100
commit952df62b6bc4580925a569e55556501200efa6c1 (patch)
tree58588f407135448c09058840f81903c99684393d
parent5d2032ca1d69213ad44445d6b253f23b44a218ab (diff)
downloadpaludis-952df62b6bc4580925a569e55556501200efa6c1.tar.gz
paludis-952df62b6bc4580925a569e55556501200efa6c1.tar.xz
cave match --enabled-only
-rw-r--r--src/clients/cave/cmd_match.cc19
-rw-r--r--src/clients/cave/cmd_search_cmdline.cc6
-rw-r--r--src/clients/cave/cmd_search_cmdline.hh3
3 files changed, 19 insertions, 9 deletions
diff --git a/src/clients/cave/cmd_match.cc b/src/clients/cave/cmd_match.cc
index 430eae8..b7f9ca7 100644
--- a/src/clients/cave/cmd_match.cc
+++ b/src/clients/cave/cmd_match.cc
@@ -149,6 +149,7 @@ namespace
struct SpecTreeAsString
{
std::list<std::string> & texts;
+ const SearchCommandLineMatchOptions & match_options;
void visit(const GenericSpecTree::NodeType<AllDepSpec>::Type & node)
{
@@ -157,7 +158,8 @@ namespace
void visit(const GenericSpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
- std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ if ((! match_options.a_enabled_only.specified()) || node.spec()->condition_met())
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
void visit(const GenericSpecTree::NodeType<AnyDepSpec>::Type & node)
@@ -219,6 +221,7 @@ namespace
struct MetadataKeyAsString
{
std::list<std::string> & texts;
+ const SearchCommandLineMatchOptions & match_options;
void visit(const MetadataValueKey<std::string> & k)
{
@@ -280,37 +283,37 @@ namespace
void visit(const MetadataSpecTreeKey<PlainTextSpecTree> & k)
{
- SpecTreeAsString m = { texts };
+ SpecTreeAsString m = { texts, match_options };
k.value()->top()->accept(m);
}
void visit(const MetadataSpecTreeKey<DependencySpecTree> & k)
{
- SpecTreeAsString m = { texts };
+ SpecTreeAsString m = { texts, match_options };
k.value()->top()->accept(m);
}
void visit(const MetadataSpecTreeKey<LicenseSpecTree> & k)
{
- SpecTreeAsString m = { texts };
+ SpecTreeAsString m = { texts, match_options };
k.value()->top()->accept(m);
}
void visit(const MetadataSpecTreeKey<ProvideSpecTree> & k)
{
- SpecTreeAsString m = { texts };
+ SpecTreeAsString m = { texts, match_options };
k.value()->top()->accept(m);
}
void visit(const MetadataSpecTreeKey<SimpleURISpecTree> & k)
{
- SpecTreeAsString m = { texts };
+ SpecTreeAsString m = { texts, match_options };
k.value()->top()->accept(m);
}
void visit(const MetadataSpecTreeKey<FetchableURISpecTree> & k)
{
- SpecTreeAsString m = { texts };
+ SpecTreeAsString m = { texts, match_options };
k.value()->top()->accept(m);
}
@@ -403,7 +406,7 @@ MatchCommand::run_hosted(
if (i == id->end_metadata())
continue;
- MetadataKeyAsString m = { texts };
+ MetadataKeyAsString m = { texts, match_options };
(*i)->accept(m);
}
diff --git a/src/clients/cave/cmd_search_cmdline.cc b/src/clients/cave/cmd_search_cmdline.cc
index bdecef7..90652ab 100644
--- a/src/clients/cave/cmd_search_cmdline.cc
+++ b/src/clients/cave/cmd_search_cmdline.cc
@@ -52,7 +52,11 @@ SearchCommandLineMatchOptions::SearchCommandLineMatchOptions(args::ArgsHandler *
a_key(&g_search_key_options, "key", 'k', "Search the named metadata key (e.g. DESCRIPTION). May be specified "
"multiple times."),
a_name(&g_search_key_options, "name", 'n', "Search package names.", true),
- a_description(&g_search_key_options, "description", 'd', "Search package descriptions.", true)
+ a_description(&g_search_key_options, "description", 'd', "Search package descriptions.", true),
+
+ g_key_handling_options(this, "Key Handling Options", "Alter how key values are interpreted."),
+ a_enabled_only(&g_key_handling_options, "enabled-only", 'e', "Only search enabled parts of conditional "
+ "dependency spec trees", true)
{
}
diff --git a/src/clients/cave/cmd_search_cmdline.hh b/src/clients/cave/cmd_search_cmdline.hh
index 437fd6c..87d3dbc 100644
--- a/src/clients/cave/cmd_search_cmdline.hh
+++ b/src/clients/cave/cmd_search_cmdline.hh
@@ -53,6 +53,9 @@ namespace paludis
args::StringSetArg a_key;
args::SwitchArg a_name;
args::SwitchArg a_description;
+
+ args::ArgsGroup g_key_handling_options;
+ args::SwitchArg a_enabled_only;
};
}
}