aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-01-27 20:42:12 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-01-27 20:42:12 +0000
commita2a18a32a9b18a4bd8d5f091eca5e7904e898c41 (patch)
tree5ae9d1e842232b29763ffa449880d4b7bd12d66f
parent2138be4ba45627fd174eb72aecff21b3ff978e7e (diff)
downloadpaludis-a2a18a32a9b18a4bd8d5f091eca5e7904e898c41.tar.gz
paludis-a2a18a32a9b18a4bd8d5f091eca5e7904e898c41.tar.xz
Show selected choice parameter
-rw-r--r--src/clients/cave/cmd_show-fmt.hh7
-rw-r--r--src/clients/cave/cmd_show.cc7
2 files changed, 11 insertions, 3 deletions
diff --git a/src/clients/cave/cmd_show-fmt.hh b/src/clients/cave/cmd_show-fmt.hh
index e57644a..f6b7afc 100644
--- a/src/clients/cave/cmd_show-fmt.hh
+++ b/src/clients/cave/cmd_show-fmt.hh
@@ -65,7 +65,12 @@ const auto fs_permitted_choice_value_enum_values = make_format_string_fetcher("s
<< "%{column 30}Permitted values:" << "\\n";
const auto fs_permitted_choice_value_enum_value = make_format_string_fetcher("show/permitted_choice_value_enum_value", 1)
- << "%{column 34}" << param<'v'>() << param_if<'d'>() << ": " << "%{column 45}" << param<'d'>() << param_endif<'d'>() << "\\n";
+ << "%{column 34}" << param<'v'>() << param_if<'d'>() << ": "
+ << "%{column 45}" << param<'d'>() << param_endif<'d'>() << "\\n";
+
+const auto fs_permitted_choice_value_enum_value_chosen = make_format_string_fetcher("show/permitted_choice_value_enum_value_chosen", 1)
+ << "%{column 34}" << c::green_or_pink() << param<'v'>() << c::normal() << param_if<'d'>() << ": "
+ << "%{column 45}" << param<'d'>() << param_endif<'d'>() << "\\n";
const auto fs_metadata_value_raw = make_format_string_fetcher("show/metadata_value_raw", 2)
<< " " << param<'i'>() << param<'i'>() << param<'i'>() << param<'i'>()
diff --git a/src/clients/cave/cmd_show.cc b/src/clients/cave/cmd_show.cc
index 9fcd485..606f477 100644
--- a/src/clients/cave/cmd_show.cc
+++ b/src/clients/cave/cmd_show.cc
@@ -346,6 +346,7 @@ namespace
struct PermittedChoiceValueParameterValuesDisplayer
{
std::ostream & out;
+ const std::string actual_value;
void visit(const PermittedChoiceValueParameterIntegerValue & v) const
{
@@ -374,7 +375,9 @@ namespace
out << fuc(fs_permitted_choice_value_enum_values());
for (auto a(v.allowed_values_and_descriptions()->begin()), a_end(v.allowed_values_and_descriptions()->end()) ;
a != a_end ; ++a)
- out << fuc(fs_permitted_choice_value_enum_value(), fv<'v'>(a->first), fv<'d'>(a->second));
+ out << fuc(
+ actual_value == a->first ? fs_permitted_choice_value_enum_value_chosen() : fs_permitted_choice_value_enum_value(),
+ fv<'v'>(a->first), fv<'d'>(a->second));
}
}
};
@@ -965,7 +968,7 @@ namespace
if ((*v)->permitted_parameter_values())
{
- PermittedChoiceValueParameterValuesDisplayer d{out};
+ PermittedChoiceValueParameterValuesDisplayer d{out, (*v)->parameter()};
(*v)->permitted_parameter_values()->accept(d);
}
}