aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-17 12:54:27 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-17 12:54:27 +0100
commit0b0b391d34f29239884dfadf5399f1a3eed1cf7c (patch)
tree873ad728e572a1b7c359353f79024d9f208b97df
parenta09238d98199165bcfb859e618bfac3d65b9089f (diff)
downloadpaludis-0b0b391d34f29239884dfadf5399f1a3eed1cf7c.tar.gz
paludis-0b0b391d34f29239884dfadf5399f1a3eed1cf7c.tar.xz
fmt show choices
-rw-r--r--src/clients/cave/cmd_show-fmt.hh12
-rw-r--r--src/clients/cave/cmd_show.cc48
-rw-r--r--src/clients/cave/formats.cc24
-rw-r--r--src/clients/cave/formats.hh5
4 files changed, 36 insertions, 53 deletions
diff --git a/src/clients/cave/cmd_show-fmt.hh b/src/clients/cave/cmd_show-fmt.hh
index edb9820..cf7835e 100644
--- a/src/clients/cave/cmd_show-fmt.hh
+++ b/src/clients/cave/cmd_show-fmt.hh
@@ -43,3 +43,15 @@ const auto fs_contents_sym = make_format_string_fetcher("show/contents_sym", 1)
<< param_if<'b'>() << "%{column 30}" << param_endif<'b'>() << param<'r'>() << " -> " << param<'v'>()
<< param_if<'b'>() << "\\n" << param_else<'b'>() << " " << param_endif<'b'>();
+const auto fs_choice_forced_enabled = make_format_string_fetcher("show/choice_forced_enabled", 1)
+ << c::green_or_pink() << "(" << param<'s'>() << ")" << c::normal() << param<'r'>();
+
+const auto fs_choice_enabled = make_format_string_fetcher("show/choice_enabled", 1)
+ << c::green_or_pink() << param<'s'>() << c::normal() << param<'r'>();
+
+const auto fs_choice_forced_disabled = make_format_string_fetcher("show/choice_forced_disabled", 1)
+ << c::red() << "(-" << param<'s'>() << ")" << c::normal() << param<'r'>();
+
+const auto fs_choice_disabled = make_format_string_fetcher("show/choice_disabled", 1)
+ << c::red() << "-" << param<'s'>() << c::normal() << param<'r'>();
+
diff --git a/src/clients/cave/cmd_show.cc b/src/clients/cave/cmd_show.cc
index 54cbeae..3c4059e 100644
--- a/src/clients/cave/cmd_show.cc
+++ b/src/clients/cave/cmd_show.cc
@@ -611,20 +611,20 @@ namespace
if ((*v)->enabled())
{
if ((*v)->locked())
- s << format_general_sr(f::show_choice_forced_enabled(), stringify((*v)->unprefixed_name()),
- added_or_changed_string(*c, *v, maybe_old_id, old_id_is_installed)) << " ";
+ s << fuc(fs_choice_forced_enabled(), fv<'s'>(stringify((*v)->unprefixed_name())),
+ fv<'r'>(added_or_changed_string(*c, *v, maybe_old_id, old_id_is_installed))) << " ";
else
- s << format_general_sr(f::show_choice_enabled(), stringify((*v)->unprefixed_name()),
- added_or_changed_string(*c, *v, maybe_old_id, old_id_is_installed)) << " ";
+ s << fuc(fs_choice_enabled(), fv<'s'>(stringify((*v)->unprefixed_name())),
+ fv<'r'>(added_or_changed_string(*c, *v, maybe_old_id, old_id_is_installed))) << " ";
}
else
{
if ((*v)->locked())
- s << format_general_sr(f::show_choice_forced_disabled(), stringify((*v)->unprefixed_name()),
- added_or_changed_string(*c, *v, maybe_old_id, old_id_is_installed)) << " ";
+ s << fuc(fs_choice_forced_disabled(), fv<'s'>(stringify((*v)->unprefixed_name())),
+ fv<'r'>(added_or_changed_string(*c, *v, maybe_old_id, old_id_is_installed))) << " ";
else
- s << format_general_sr(f::show_choice_disabled(), stringify((*v)->unprefixed_name()),
- added_or_changed_string(*c, *v, maybe_old_id, old_id_is_installed)) << " ";
+ s << fuc(fs_choice_disabled(), fv<'s'>(stringify((*v)->unprefixed_name())),
+ fv<'r'>(added_or_changed_string(*c, *v, maybe_old_id, old_id_is_installed))) << " ";
}
}
}
@@ -680,20 +680,20 @@ namespace
{
cout << format_general_rhvib(
(cmdline.a_raw_names.specified() ? f::show_metadata_key_value_raw() : f::show_metadata_key_value_human()),
- format_general_sr(f::show_choice_forced_enabled(), stringify((*v)->name_with_prefix()),
- added_or_changed_string(*c, *v, maybe_old_id, old_id_is_installed)),
- format_general_sr(f::show_choice_forced_enabled(), stringify((*v)->unprefixed_name()),
- added_or_changed_string(*c, *v, maybe_old_id, old_id_is_installed)),
+ fuc(fs_choice_forced_enabled(), fv<'s'>(stringify((*v)->name_with_prefix())),
+ fv<'r'>(added_or_changed_string(*c, *v, maybe_old_id, old_id_is_installed))),
+ fuc(fs_choice_forced_enabled(), fv<'s'>(stringify((*v)->unprefixed_name())),
+ fv<'r'>(added_or_changed_string(*c, *v, maybe_old_id, old_id_is_installed))),
(*v)->description(), indent + 2, important);
}
else
{
cout << format_general_rhvib(
(cmdline.a_raw_names.specified() ? f::show_metadata_key_value_raw() : f::show_metadata_key_value_human()),
- format_general_sr(f::show_choice_enabled(), stringify((*v)->name_with_prefix()),
- added_or_changed_string(*c, *v, maybe_old_id, old_id_is_installed)),
- format_general_sr(f::show_choice_enabled(), stringify((*v)->unprefixed_name()),
- added_or_changed_string(*c, *v, maybe_old_id, old_id_is_installed)),
+ fuc(fs_choice_enabled(), fv<'s'>(stringify((*v)->name_with_prefix())),
+ fv<'r'>(added_or_changed_string(*c, *v, maybe_old_id, old_id_is_installed))),
+ fuc(fs_choice_enabled(), fv<'s'>(stringify((*v)->unprefixed_name())),
+ fv<'r'>(added_or_changed_string(*c, *v, maybe_old_id, old_id_is_installed))),
(*v)->description(), indent + 2, important);
}
}
@@ -703,20 +703,20 @@ namespace
{
cout << format_general_rhvib(
(cmdline.a_raw_names.specified() ? f::show_metadata_key_value_raw() : f::show_metadata_key_value_human()),
- format_general_sr(f::show_choice_forced_disabled(), stringify((*v)->name_with_prefix()),
- added_or_changed_string(*c, *v, maybe_old_id, old_id_is_installed)),
- format_general_sr(f::show_choice_forced_disabled(), stringify((*v)->unprefixed_name()),
- added_or_changed_string(*c, *v, maybe_old_id, old_id_is_installed)),
+ fuc(fs_choice_forced_disabled(), fv<'s'>(stringify((*v)->name_with_prefix())),
+ fv<'r'>(added_or_changed_string(*c, *v, maybe_old_id, old_id_is_installed))),
+ fuc(fs_choice_forced_disabled(), fv<'s'>(stringify((*v)->unprefixed_name())),
+ fv<'r'>(added_or_changed_string(*c, *v, maybe_old_id, old_id_is_installed))),
(*v)->description(), indent + 2, important);
}
else
{
cout << format_general_rhvib(
(cmdline.a_raw_names.specified() ? f::show_metadata_key_value_raw() : f::show_metadata_key_value_human()),
- format_general_sr(f::show_choice_disabled(), stringify((*v)->name_with_prefix()),
- added_or_changed_string(*c, *v, maybe_old_id, old_id_is_installed)),
- format_general_sr(f::show_choice_disabled(), stringify((*v)->unprefixed_name()),
- added_or_changed_string(*c, *v, maybe_old_id, old_id_is_installed)),
+ fuc(fs_choice_disabled(), fv<'s'>(stringify((*v)->name_with_prefix())),
+ fv<'r'>(added_or_changed_string(*c, *v, maybe_old_id, old_id_is_installed))),
+ fuc(fs_choice_disabled(), fv<'s'>(stringify((*v)->unprefixed_name())),
+ fv<'r'>(added_or_changed_string(*c, *v, maybe_old_id, old_id_is_installed))),
(*v)->description(), indent + 2, important);
}
}
diff --git a/src/clients/cave/formats.cc b/src/clients/cave/formats.cc
index 7715d26..dedb933 100644
--- a/src/clients/cave/formats.cc
+++ b/src/clients/cave/formats.cc
@@ -232,27 +232,3 @@ paludis::cave::f::show_package_id_masks_overridden()
return " " + c::green_or_pink() + "%s" + c::normal() + "\\n";
}
-const std::string
-paludis::cave::f::show_choice_forced_enabled()
-{
- return c::green_or_pink() + "(%s)" + c::normal() + "%r";
-}
-
-const std::string
-paludis::cave::f::show_choice_enabled()
-{
- return c::green_or_pink() + "%s" + c::normal() + "%r";
-}
-
-const std::string
-paludis::cave::f::show_choice_forced_disabled()
-{
- return c::red() + "(-%s)" + c::normal() + "%r";
-}
-
-const std::string
-paludis::cave::f::show_choice_disabled()
-{
- return c::red() + "-%s" + c::normal() + "%r";
-}
-
diff --git a/src/clients/cave/formats.hh b/src/clients/cave/formats.hh
index ce61a63..0d05fcc 100644
--- a/src/clients/cave/formats.hh
+++ b/src/clients/cave/formats.hh
@@ -68,11 +68,6 @@ namespace paludis
const std::string show_metadata_continued_value();
const std::string show_metadata_subsection_raw();
const std::string show_metadata_subsection_human();
-
- const std::string show_choice_forced_enabled();
- const std::string show_choice_enabled();
- const std::string show_choice_forced_disabled();
- const std::string show_choice_disabled();
}
}
}