aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-16 21:05:35 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-16 21:15:08 +0100
commite673076a22d3ac3261a102b67770f80bf2c744c2 (patch)
tree97797b6ec2850f806cfbfddf8e928ce477c3231a
parentfa6863d997543b56f0911194187cfbe965acbce6 (diff)
downloadpaludis-e673076a22d3ac3261a102b67770f80bf2c744c2.tar.gz
paludis-e673076a22d3ac3261a102b67770f80bf2c744c2.tar.xz
fmt report
-rw-r--r--src/clients/cave/Makefile.am5
-rw-r--r--src/clients/cave/cmd_print_formats.cc1
-rw-r--r--src/clients/cave/cmd_report-fmt.hh20
-rw-r--r--src/clients/cave/cmd_report.cc16
-rw-r--r--src/clients/cave/format_user_config.hh11
-rw-r--r--src/clients/cave/formats.cc36
-rw-r--r--src/clients/cave/formats.hh7
7 files changed, 42 insertions, 54 deletions
diff --git a/src/clients/cave/Makefile.am b/src/clients/cave/Makefile.am
index a608e9c..68ff99b 100644
--- a/src/clients/cave/Makefile.am
+++ b/src/clients/cave/Makefile.am
@@ -146,7 +146,7 @@ libcave_a_SOURCES = \
cmd_print_sets.cc cmd_print_sets.hh \
cmd_print_sync_protocols.cc cmd_print_sync_protocols.hh \
cmd_purge.cc cmd_purge.hh \
- cmd_report.cc cmd_report.hh \
+ cmd_report.cc cmd_report.hh cmd_report-fmt.hh \
cmd_resolve.cc cmd_resolve.hh \
cmd_resolve_cmdline.cc cmd_resolve_cmdline.hh \
cmd_resolve_display_callback.cc cmd_resolve_display_callback.hh \
@@ -174,9 +174,6 @@ libcave_a_SOURCES = \
resolve_common.cc resolve_common.hh \
resume_data.cc resume_data.hh
-# cmd_print_sync_protocol_metadata.cc \
-# cmd_report.cc
-
TESTS = \
continue_on_failure_TEST
diff --git a/src/clients/cave/cmd_print_formats.cc b/src/clients/cave/cmd_print_formats.cc
index 71945d7..a476071 100644
--- a/src/clients/cave/cmd_print_formats.cc
+++ b/src/clients/cave/cmd_print_formats.cc
@@ -103,6 +103,7 @@ namespace
{
#include "cmd_contents-fmt.hh"
+#include "cmd_report-fmt.hh"
#include "cmd_verify-fmt.hh"
}
diff --git a/src/clients/cave/cmd_report-fmt.hh b/src/clients/cave/cmd_report-fmt.hh
new file mode 100644
index 0000000..30f6c14
--- /dev/null
+++ b/src/clients/cave/cmd_report-fmt.hh
@@ -0,0 +1,20 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+const auto fs_package_id = make_format_string_fetcher("report/package_id", 1)
+ << c::bold_blue() << param<'s'>() << c::normal() << "\\n";
+
+const auto fs_package_no_origin = make_format_string_fetcher("report/no_origin", 1)
+ << " No longer exists in original repository " << param<'s'>() << "\\n";
+
+const auto fs_package_origin = make_format_string_fetcher("report/origin", 1)
+ << " Origin " << param<'s'>() << ":\\n";
+
+const auto fs_package_origin_masked = make_format_string_fetcher("report/origin_masked", 1)
+ << " Masked in original repository\\n";
+
+const auto fs_package_origin_insecure = make_format_string_fetcher("report/origin_insecure", 1)
+ << " Marked as insecure\\n";
+
+const auto fs_package_unused = make_format_string_fetcher("report/unused", 1)
+ << " Not used by any package in world\\n";
+
diff --git a/src/clients/cave/cmd_report.cc b/src/clients/cave/cmd_report.cc
index c901540..9ea49f0 100644
--- a/src/clients/cave/cmd_report.cc
+++ b/src/clients/cave/cmd_report.cc
@@ -19,7 +19,7 @@
#include "cmd_report.hh"
#include "colour_formatter.hh"
-#include "format_general.hh"
+#include "format_user_config.hh"
#include "formats.hh"
#include "exceptions.hh"
@@ -69,6 +69,8 @@ using std::endl;
namespace
{
+#include "cmd_report-fmt.hh"
+
struct ReportCommandLine :
CaveCommandCommandLine
{
@@ -126,7 +128,7 @@ namespace
{
if (! already)
{
- cout << format_general_s(f::report_package_id(), stringify(*id));
+ cout << fuc(fs_package_id(), fv<'s'>(stringify(*id)));
already = true;
}
}
@@ -141,7 +143,7 @@ namespace
if (! already_origin)
{
- cout << format_general_s(f::report_package_origin(), stringify(*origin_id));
+ cout << fuc(fs_package_origin(), fv<'s'>(stringify(*origin_id)));
already_origin = true;
}
}
@@ -212,7 +214,7 @@ ReportCommand::run(
std::string repos;
if ((*i)->from_repositories_key())
repos = join((*i)->from_repositories_key()->value()->begin(), (*i)->from_repositories_key()->value()->end(), ", ");
- cout << format_general_s(f::report_package_no_origin(), repos);
+ cout << fuc(fs_package_no_origin(), fv<'s'>(repos));
}
}
else
@@ -220,13 +222,13 @@ ReportCommand::run(
if (origin->masked())
{
need_heading_origin(done_heading, done_heading_origin, *i, origin);
- cout << format_general_s(f::report_package_origin_masked(), "");
+ cout << fuc(fs_package_origin_masked());
}
if (insecurity && match_package_in_set(*env, *insecurity, *origin, { }))
{
need_heading_origin(done_heading, done_heading_origin, *i, origin);
- cout << format_general_s(f::report_package_origin_insecure(), "");
+ cout << fuc(fs_package_origin_insecure());
}
}
@@ -241,7 +243,7 @@ ReportCommand::run(
else
{
need_heading(done_heading, *i);
- cout << format_general_s(f::report_package_unused(), "");
+ cout << fuc(fs_package_unused());
}
}
diff --git a/src/clients/cave/format_user_config.hh b/src/clients/cave/format_user_config.hh
index 5835e8c..0730b9e 100644
--- a/src/clients/cave/format_user_config.hh
+++ b/src/clients/cave/format_user_config.hh
@@ -117,11 +117,22 @@ namespace paludis
OrderedFormatValuesBase<cs_>(this->map, c)...
{
}
+
+ /* just to shut gcc up */
+ OrderedFormatValues(const FormatValues<> &)
+ {
+ }
};
template <char... cs_>
struct MakeOrderedFormatValues;
+ template <>
+ struct MakeOrderedFormatValues<>
+ {
+ typedef OrderedFormatValues<> Type;
+ };
+
template <char a_>
struct MakeOrderedFormatValues<a_>
{
diff --git a/src/clients/cave/formats.cc b/src/clients/cave/formats.cc
index dedb744..d38399b 100644
--- a/src/clients/cave/formats.cc
+++ b/src/clients/cave/formats.cc
@@ -652,39 +652,3 @@ paludis::cave::f::executables_file()
return c::bold_blue_or_pink() + "%s" + c::normal() + "\\n";
}
-const std::string
-paludis::cave::f::report_package_id()
-{
- return c::bold_blue() + "%s" + c::normal() + "\\n";
-}
-
-const std::string
-paludis::cave::f::report_package_no_origin()
-{
- return " No longer exists in original repository %s\\n";
-}
-
-const std::string
-paludis::cave::f::report_package_origin()
-{
- return " Origin %s:\\n";
-}
-
-const std::string
-paludis::cave::f::report_package_origin_masked()
-{
- return " Masked in original repository\\n";
-}
-
-const std::string
-paludis::cave::f::report_package_origin_insecure()
-{
- return " Marked as insecure\\n";
-}
-
-const std::string
-paludis::cave::f::report_package_unused()
-{
- return " Not used by any package in world\\n";
-}
-
diff --git a/src/clients/cave/formats.hh b/src/clients/cave/formats.hh
index e35685b..004de1f 100644
--- a/src/clients/cave/formats.hh
+++ b/src/clients/cave/formats.hh
@@ -164,13 +164,6 @@ namespace paludis
const std::string owner_id();
const std::string executables_file();
-
- const std::string report_package_id();
- const std::string report_package_no_origin();
- const std::string report_package_origin();
- const std::string report_package_origin_masked();
- const std::string report_package_origin_insecure();
- const std::string report_package_unused();
}
}
}