aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-17 12:18:10 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-17 12:18:10 +0100
commitb16723cdaaac3e6e8771c52f356c6bc0781e2ae7 (patch)
tree3321f9786cd2f6cce59a45733b3b6a7a07b0f4e7
parent78122dea7896e886dc221b008f8c7e6841431049 (diff)
downloadpaludis-b16723cdaaac3e6e8771c52f356c6bc0781e2ae7.tar.gz
paludis-b16723cdaaac3e6e8771c52f356c6bc0781e2ae7.tar.xz
fmt show set
-rw-r--r--src/clients/cave/cmd_show-fmt.hh15
-rw-r--r--src/clients/cave/cmd_show.cc15
-rw-r--r--src/clients/cave/formats.cc30
-rw-r--r--src/clients/cave/formats.hh6
-rw-r--r--src/clients/cave/select_format_for_spec.cc8
5 files changed, 31 insertions, 43 deletions
diff --git a/src/clients/cave/cmd_show-fmt.hh b/src/clients/cave/cmd_show-fmt.hh
index 89ff33b..67ab44a 100644
--- a/src/clients/cave/cmd_show-fmt.hh
+++ b/src/clients/cave/cmd_show-fmt.hh
@@ -15,3 +15,18 @@ const auto fs_wildcard_spec_installable = make_format_string_fetcher("show/wildc
const auto fs_wildcard_spec_unavailable = make_format_string_fetcher("show/wildcard_spec_unavailable", 1)
<< " " << c::red() << param<'s'>() << c::normal() << "\\n";
+const auto fs_set_heading = make_format_string_fetcher("show/set_heading", 1)
+ << "* " << c::bold_blue_or_pink() << param<'s'>() << c::normal() << "\\n";
+
+const auto fs_set_set = make_format_string_fetcher("show/set_set", 1)
+ << param<'i'>() << param<'i'>() << param<'i'>() << param<'i'>() << c::blue_or_pink() << param<'s'>() << c::normal() << "\\n";
+
+const auto fs_set_spec_installed = make_format_string_fetcher("show/set_spec_installed", 1)
+ << param<'i'>() << param<'i'>() << param<'i'>() << param<'i'>() << c::bold_green_or_pink() << param<'s'>() << c::normal() << "\\n";
+
+const auto fs_set_spec_installable = make_format_string_fetcher("show/set_spec_installable", 1)
+ << param<'i'>() << param<'i'>() << param<'i'>() << param<'i'>() << c::green_or_pink() << param<'s'>() << c::normal() << "\\n";
+
+const auto fs_set_spec_unavailable = make_format_string_fetcher("show/set_spec_unavailable", 1)
+ << param<'i'>() << param<'i'>() << param<'i'>() << param<'i'>() << c::bold_red() << param<'s'>() << c::normal() << "\\n";
+
diff --git a/src/clients/cave/cmd_show.cc b/src/clients/cave/cmd_show.cc
index 76ad186..9c37c2f 100644
--- a/src/clients/cave/cmd_show.cc
+++ b/src/clients/cave/cmd_show.cc
@@ -159,16 +159,17 @@ namespace
void visit(const SetSpecTree::NodeType<PackageDepSpec>::Type & node)
{
- cout << format_general_si(select_format_for_spec(env, *node.spec(),
- f::show_set_spec_installed(),
- f::show_set_spec_installable(),
- f::show_set_spec_unavailable()),
- stringify(*node.spec()), indent);
+ cout << fuc(select_format_for_spec(env, *node.spec(),
+ fs_set_spec_installed(),
+ fs_set_spec_installable(),
+ fs_set_spec_unavailable()),
+ fv<'s'>(stringify(*node.spec())),
+ fv<'i'>(std::string(indent, ' ')));
}
void visit(const SetSpecTree::NodeType<NamedSetDepSpec>::Type & node)
{
- cout << format_general_si(f::show_set_set(), stringify(*node.spec()), indent);
+ cout << fuc(fs_set_set(), fv<'s'>(stringify(*node.spec())), fv<'i'>(std::string(indent, ' ')));
const std::shared_ptr<const SetSpecTree> set(env->set(node.spec()->name()));
if (! set)
@@ -192,7 +193,7 @@ namespace
void do_one_set(const std::shared_ptr<Environment> & env, const SetName & s)
{
- cout << format_general_s(f::show_set_heading(), stringify(s));
+ cout << fuc(fs_set_heading(), fv<'s'>(stringify(s)));
const std::shared_ptr<const SetSpecTree> set(env->set(s));
if (! set)
diff --git a/src/clients/cave/formats.cc b/src/clients/cave/formats.cc
index 3e8f8f7..fa54407 100644
--- a/src/clients/cave/formats.cc
+++ b/src/clients/cave/formats.cc
@@ -137,36 +137,6 @@ paludis::cave::c::bold_normal()
}
const std::string
-paludis::cave::f::show_set_heading()
-{
- return "* " + c::bold_blue_or_pink() + "%s" + c::normal() + "\\n";
-}
-
-const std::string
-paludis::cave::f::show_set_set()
-{
- return "%i%i%i%i" + c::blue_or_pink() + "%s" + c::normal() + "\\n";
-}
-
-const std::string
-paludis::cave::f::show_set_spec_installed()
-{
- return "%i%i%i%i" + c::bold_green_or_pink() + "%s" + c::normal() + "\\n";
-}
-
-const std::string
-paludis::cave::f::show_set_spec_installable()
-{
- return "%i%i%i%i" + c::green_or_pink() + "%s" + c::normal() + "\\n";
-}
-
-const std::string
-paludis::cave::f::show_set_spec_unavailable()
-{
- return "%i%i%i%i" + c::red() + "%s" + c::normal() + "\\n";
-}
-
-const std::string
paludis::cave::f::show_metadata_key_value_raw()
{
return " %i%i%i%i%{if b}" + c::bold_normal() + "%{endif}" + "%r" + c::normal() + "%{column 30}%v\\n";
diff --git a/src/clients/cave/formats.hh b/src/clients/cave/formats.hh
index 3323e20..557c138 100644
--- a/src/clients/cave/formats.hh
+++ b/src/clients/cave/formats.hh
@@ -50,12 +50,6 @@ namespace paludis
namespace f
{
- const std::string show_set_heading();
- const std::string show_set_set();
- const std::string show_set_spec_installed();
- const std::string show_set_spec_installable();
- const std::string show_set_spec_unavailable();
-
const std::string show_package_heading();
const std::string show_package_repository();
const std::string show_package_version_installed();
diff --git a/src/clients/cave/select_format_for_spec.cc b/src/clients/cave/select_format_for_spec.cc
index c7df9ba..8de7dbb 100644
--- a/src/clients/cave/select_format_for_spec.cc
+++ b/src/clients/cave/select_format_for_spec.cc
@@ -56,6 +56,14 @@ template std::string paludis::cave::select_format_for_spec(
const std::string & if_unavailable
);
+template FormatString<'i', 's'> paludis::cave::select_format_for_spec(
+ const std::shared_ptr<const Environment> & env,
+ const PackageDepSpec & spec,
+ const FormatString<'i', 's'> & if_installed,
+ const FormatString<'i', 's'> & if_installable,
+ const FormatString<'i', 's'> & if_unavailable
+ );
+
template FormatString<'s'> paludis::cave::select_format_for_spec(
const std::shared_ptr<const Environment> & env,
const PackageDepSpec & spec,