aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-17 13:51:01 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-17 13:51:01 +0100
commitf54130c4146c3efac9fab3bbd56fb6fd49dcf2b7 (patch)
tree408b71276ca76ac3d5d169d07bc0ef7cc3456d3e
parent9a11823e1d8a389e00086f22d4e3742a18a12122 (diff)
downloadpaludis-f54130c4146c3efac9fab3bbd56fb6fd49dcf2b7.tar.gz
paludis-f54130c4146c3efac9fab3bbd56fb6fd49dcf2b7.tar.xz
fmt show package
-rw-r--r--src/clients/cave/cmd_show-fmt.hh24
-rw-r--r--src/clients/cave/cmd_show.cc18
-rw-r--r--src/clients/cave/formats.cc48
-rw-r--r--src/clients/cave/formats.hh12
4 files changed, 33 insertions, 69 deletions
diff --git a/src/clients/cave/cmd_show-fmt.hh b/src/clients/cave/cmd_show-fmt.hh
index 5ac04ec..384bea7 100644
--- a/src/clients/cave/cmd_show-fmt.hh
+++ b/src/clients/cave/cmd_show-fmt.hh
@@ -85,3 +85,27 @@ const auto fs_package_id_masks = make_format_string_fetcher("show/package_id_mas
const auto fs_package_id_masks_overridden = make_format_string_fetcher("show/package_id_masks_overridden", 1)
<< " " << c::green_or_pink() << param<'s'>() << c::normal() << "\\n";
+const auto fs_package_heading = make_format_string_fetcher("show/package_heading", 1)
+ << "* " << c::bold_blue_or_pink() << param<'s'>() << c::normal() << "\\n";
+
+const auto fs_package_version_installed = make_format_string_fetcher("show/package_version_installed", 1)
+ << c::bold_green_or_pink() << param<'s'>() << c::normal();
+
+const auto fs_package_version_installable = make_format_string_fetcher("show/package_version_installable", 1)
+ << c::green_or_pink() << param<'s'>() << c::normal();
+
+const auto fs_package_version_unavailable = make_format_string_fetcher("show/package_version_unavailable", 1)
+ << c::red() << "(" << param<'s'>() << ")" << param<'r'>() << c::normal();
+
+const auto fs_package_repository = make_format_string_fetcher("show/package_repository", 1)
+ << " ::" << param<'s'>() << "%{column 30}";
+
+const auto fs_package_best = make_format_string_fetcher("show/package_best", 1)
+ << "*";
+
+const auto fs_package_slot = make_format_string_fetcher("show/package_slot", 1)
+ << " {:" << param<'s'>() << "}";
+
+const auto fs_package_no_slot = make_format_string_fetcher("show/package_no_slot", 1)
+ << " {no slot}";
+
diff --git a/src/clients/cave/cmd_show.cc b/src/clients/cave/cmd_show.cc
index 639e167..97e7c40 100644
--- a/src/clients/cave/cmd_show.cc
+++ b/src/clients/cave/cmd_show.cc
@@ -992,7 +992,7 @@ namespace
const std::shared_ptr<Environment> & env,
const PackageDepSpec & s)
{
- cout << format_general_s(f::show_package_heading(), stringify(s));
+ cout << fuc(fs_package_heading(), fv<'s'>(stringify(s)));
const std::shared_ptr<const PackageIDSequence> ids((*env)[selection::AllVersionsGroupedBySlot(
generator::Matches(s, { }))]);
@@ -1035,7 +1035,7 @@ namespace
for (std::set<RepositoryName>::const_iterator r(repos.begin()), r_end(repos.end()) ;
r != r_end ; ++r)
{
- cout << format_general_s(f::show_package_repository(), stringify(*r));
+ cout << fuc(fs_package_repository(), fv<'s'>(stringify(*r)));
std::string slot_name;
bool need_space(false);
for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
@@ -1047,7 +1047,7 @@ namespace
if (slot_name != slot_as_string(*i))
{
if (! slot_name.empty())
- cout << format_general_s(f::show_package_slot(), slot_name);
+ cout << fuc(fs_package_slot(), fv<'s'>(slot_name));
slot_name = slot_as_string(*i);
}
@@ -1056,7 +1056,7 @@ namespace
need_space = true;
if ((*i)->repository()->installed_root_key())
- cout << format_general_s(f::show_package_version_installed(), stringify((*i)->canonical_form(idcf_version)));
+ cout << fuc(fs_package_version_installed(), fv<'s'>(stringify((*i)->canonical_form(idcf_version))));
else
{
std::string rr;
@@ -1068,7 +1068,7 @@ namespace
rr = "(" + rr + ")";
if (! (*i)->masked())
- cout << format_general_sr(f::show_package_version_installable(), stringify((*i)->canonical_form(idcf_version)), rr);
+ cout << fuc(fs_package_version_installable(), fv<'s'>(stringify((*i)->canonical_form(idcf_version))));
else
{
std::string rs;
@@ -1076,18 +1076,18 @@ namespace
m != m_end ; ++m)
rs.append(stringify((*m)->key()));
rr = rs + rr;
- cout << format_general_sr(f::show_package_version_unavailable(), stringify((*i)->canonical_form(idcf_version)), rr);
+ cout << fuc(fs_package_version_unavailable(), fv<'s'>(stringify((*i)->canonical_form(idcf_version))), fv<'r'>(rr));
}
}
if (best_installable && (**i == *best_installable))
- cout << format_general_s(f::show_package_best(), "");
+ cout << fuc(fs_package_best());
}
if (slot_name.empty())
- cout << format_general_s(f::show_package_no_slot(), slot_name);
+ cout << fuc(fs_package_no_slot());
else
- cout << format_general_s(f::show_package_slot(), slot_name);
+ cout << fuc(fs_package_slot(), fv<'s'>(slot_name));
cout << endl;
}
diff --git a/src/clients/cave/formats.cc b/src/clients/cave/formats.cc
index df938c3..ef2571d 100644
--- a/src/clients/cave/formats.cc
+++ b/src/clients/cave/formats.cc
@@ -136,51 +136,3 @@ paludis::cave::c::bold_normal()
return FormatUserConfigFile::get_instance()->fetch("bold_normal", 0, "");
}
-const std::string
-paludis::cave::f::show_package_heading()
-{
- return "* " + c::bold_blue_or_pink() + "%s" + c::normal() + "\\n";
-}
-
-const std::string
-paludis::cave::f::show_package_version_installed()
-{
- return c::bold_green_or_pink() + "%s" + c::normal();
-}
-
-const std::string
-paludis::cave::f::show_package_version_installable()
-{
- return c::green_or_pink() + "%s%r" + c::normal();
-}
-
-const std::string
-paludis::cave::f::show_package_version_unavailable()
-{
- return c::red() + "(%s)%r" + c::normal();
-}
-
-const std::string
-paludis::cave::f::show_package_repository()
-{
- return " ::%s%{column 30}";
-}
-
-const std::string
-paludis::cave::f::show_package_best()
-{
- return "*";
-}
-
-const std::string
-paludis::cave::f::show_package_slot()
-{
- return " {:%s}";
-}
-
-const std::string
-paludis::cave::f::show_package_no_slot()
-{
- return " {no slot}";
-}
-
diff --git a/src/clients/cave/formats.hh b/src/clients/cave/formats.hh
index e323e65..aa403cf 100644
--- a/src/clients/cave/formats.hh
+++ b/src/clients/cave/formats.hh
@@ -47,18 +47,6 @@ namespace paludis
const std::string bold_normal();
const std::string normal();
}
-
- namespace f
- {
- const std::string show_package_heading();
- const std::string show_package_repository();
- const std::string show_package_version_installed();
- const std::string show_package_version_installable();
- const std::string show_package_version_unavailable();
- const std::string show_package_best();
- const std::string show_package_slot();
- const std::string show_package_no_slot();
- }
}
}