aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-17 15:22:07 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-17 18:37:32 +0100
commita2ab68354ec8c111ed80c41a8700b35e1a0abb8e (patch)
treeb72905b1dfef089679b1f349e1271933796125b6
parent66831bf80a60e46958ac07a270bae92a6c134b1f (diff)
downloadpaludis-a2ab68354ec8c111ed80c41a8700b35e1a0abb8e.tar.gz
paludis-a2ab68354ec8c111ed80c41a8700b35e1a0abb8e.tar.xz
fmt execute-resolution
-rw-r--r--src/clients/cave/Makefile.am2
-rw-r--r--src/clients/cave/cmd_execute_resolution-fmt.hh57
-rw-r--r--src/clients/cave/cmd_execute_resolution.cc66
-rw-r--r--src/clients/cave/cmd_print_formats.cc2
4 files changed, 89 insertions, 38 deletions
diff --git a/src/clients/cave/Makefile.am b/src/clients/cave/Makefile.am
index c097267..bfcdc40 100644
--- a/src/clients/cave/Makefile.am
+++ b/src/clients/cave/Makefile.am
@@ -115,7 +115,7 @@ libcave_a_SOURCES = \
cmd_config.cc cmd_config.hh \
cmd_display_resolution.cc cmd_display_resolution.hh \
cmd_executables.cc cmd_executables.hh cmd_executables-fmt.hh \
- cmd_execute_resolution.cc cmd_execute_resolution.hh \
+ cmd_execute_resolution.cc cmd_execute_resolution.hh cmd_execute_resolution-fmt.hh \
cmd_find_candidates.cc cmd_find_candidates.hh \
cmd_fix_cache.cc cmd_fix_cache.hh cmd_fix_cache-fmt.hh \
cmd_fix_linkage.cc cmd_fix_linkage.hh \
diff --git a/src/clients/cave/cmd_execute_resolution-fmt.hh b/src/clients/cave/cmd_execute_resolution-fmt.hh
new file mode 100644
index 0000000..7c26e90
--- /dev/null
+++ b/src/clients/cave/cmd_execute_resolution-fmt.hh
@@ -0,0 +1,57 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+const auto fs_erasing_resume_file = make_format_string_fetcher("execute-resolution/erasing_resume_file", 1)
+ << "\\nErasing resume file " << param<'f'>() << "..." << "\\n";
+
+const auto fs_writing_resume_file = make_format_string_fetcher("execute-resolution/writing_resume_file", 1)
+ << "\\nWriting resume information to " << param<'f'>() << "..." << "\\n";
+
+const auto fs_starting_action = make_format_string_fetcher("execute-resolution/starting_action", 1)
+ << "\\n" << c::bold_blue_or_pink() << param<'x'>() << " of " << param<'y'>() << ": Starting "
+ << param<'a'>() << " for " << param<'i'>() << param<'r'>() << "..." << c::normal() << "\\n\\n";
+
+const auto fs_done_action = make_format_string_fetcher("execute-resolution/done_action", 1)
+ << c::bold_green_or_pink() << "Done " << param<'a'>() << " for " << param<'i'>()
+ << param<'r'>() << c::normal() << "\\n\\n";
+
+const auto fs_failed_action = make_format_string_fetcher("execute-resolution/failed_action", 1)
+ << c::bold_red() << "Failed " << param<'a'>() << " for " << param<'i'>()
+ << param<'r'>() << c::normal() << "\\n\\n";
+
+const auto fs_special_set_world = make_format_string_fetcher("execute-resolution/special_set_world", 1)
+ << "* Special set '" << param<'a'>() << "' does not belong in world" << "\\n";
+
+const auto fs_not_removing_world = make_format_string_fetcher("execute-resolution/not_removing_world", 1)
+ << "* Not removing '" << param<'a'>() << "'" << "\\n";
+
+const auto fs_not_adding_world = make_format_string_fetcher("execute-resolution/not_adding_world", 1)
+ << "* Not adding '" << param<'a'>() << "'" << "\\n";
+
+const auto fs_updating_world = make_format_string_fetcher("execute-resolution/updating_world", 1)
+ << "\\n" << c::bold_green_or_pink() << "Updating world" << c::normal() << "\\n\\n";
+
+const auto fs_already_action = make_format_string_fetcher("execute-resolution/already_action", 1)
+ << "\\n" << c::bold_green_or_pink() << param<'x'>() << " of " << param<'y'>() << ": Already "
+ << param<'s'>() << " for " << param<'t'>() << c::normal() << "\\n\\n";
+
+const auto fs_output_heading = make_format_string_fetcher("execute-resolution/output_heading", 1)
+ << "\\n" << c::bold_yellow() << param<'h'>() << c::normal() << "\\n\\n";
+
+const auto fs_no_output = make_format_string_fetcher("execute-resolution/no_output", 1)
+ << "-> (no output for " << param<'n'>() << " seconds)" << "\\n";
+
+const auto fs_summary_heading = make_format_string_fetcher("execute-resolution/summary_heading", 1)
+ << "\\n" << c::bold_blue() << "Summary:" << c::normal() << "\\n\\n";
+
+const auto fs_summary_job_pending = make_format_string_fetcher("execute-resolution/summary_job_pending", 1)
+ << c::bold_yellow() << "pending: " << c::normal() << param<'s'>() << "\\n";
+
+const auto fs_summary_job_succeeded = make_format_string_fetcher("execute-resolution/summary_job_succeeded", 1)
+ << c::bold_green_or_pink() << "succeeded: " << c::normal() << param<'s'>() << "\\n";
+
+const auto fs_summary_job_failed = make_format_string_fetcher("execute-resolution/summary_job_failed", 1)
+ << c::bold_red() << "failed: " << c::normal() << param<'s'>() << "\\n";
+
+const auto fs_summary_job_skipped = make_format_string_fetcher("execute-resolution/summary_job_skipped", 1)
+ << c::bold_yellow() << "skipped: " << c::normal() << param<'s'>() << "\\n";
+
diff --git a/src/clients/cave/cmd_execute_resolution.cc b/src/clients/cave/cmd_execute_resolution.cc
index d2577dc..1945aba 100644
--- a/src/clients/cave/cmd_execute_resolution.cc
+++ b/src/clients/cave/cmd_execute_resolution.cc
@@ -25,6 +25,7 @@
#include "colours.hh"
#include "colour_formatter.hh"
#include "resume_data.hh"
+#include "format_user_config.hh"
#include <paludis/args/do_help.hh>
#include <paludis/args/escape.hh>
#include <paludis/util/safe_ifstream.hh>
@@ -95,6 +96,8 @@ using std::endl;
namespace
{
+#include "cmd_execute_resolution-fmt.hh"
+
struct ExecuteResolutionCommandLine :
CaveCommandCommandLine
{
@@ -161,7 +164,7 @@ namespace
{
if (erase)
{
- cout << endl << "Erasing resume file " << resume_file << "..." << endl;
+ cout << fuc(fs_erasing_resume_file(), fv<'f'>(stringify(resume_file)));
resume_file.unlink();
}
}
@@ -181,7 +184,7 @@ namespace
n::world_specs() = world_specs
));
- cout << endl << "Writing resume information to " << resume_file << "..." << endl;
+ cout << fuc(fs_writing_resume_file(), fv<'f'>(stringify(resume_file)));
SafeOFStream stream(resume_file);
Serialiser ser(stream);
resume_data.serialise(ser);
@@ -296,12 +299,9 @@ namespace
const std::shared_ptr<const Sequence<PackageDepSpec> > & maybe_replacing_specs,
const int x, const int y)
{
- cout << endl;
- cout << c::bold_blue() << x << " of " << y << ": Starting " << action << " for "
- << join(indirect_iterator(ids->begin()), indirect_iterator(ids->end()), ", ")
- << maybe_replacing(env, ids, maybe_replacing_specs)
- << "..." << c::normal() << endl;
- cout << endl;
+ cout << fuc(fs_starting_action(), fv<'x'>(stringify(x)), fv<'y'>(stringify(y)),
+ fv<'a'>(action), fv<'i'>(join(indirect_iterator(ids->begin()), indirect_iterator(ids->end()), ", ")),
+ fv<'r'>(maybe_replacing(env, ids, maybe_replacing_specs)));
}
void done_action(
@@ -313,14 +313,13 @@ namespace
{
cout << endl;
if (success)
- cout << c::bold_green() << "Done " << action << " for "
- << join(indirect_iterator(ids->begin()), indirect_iterator(ids->end()), ", ")
- << maybe_replacing(env, ids, maybe_replacing_specs) << c::normal() << endl;
+ cout << fuc(fs_done_action(),
+ fv<'a'>(action), fv<'i'>(join(indirect_iterator(ids->begin()), indirect_iterator(ids->end()), ", ")),
+ fv<'r'>(maybe_replacing(env, ids, maybe_replacing_specs)));
else
- cout << c::bold_red() << "Failed " << action << " for "
- << join(indirect_iterator(ids->begin()), indirect_iterator(ids->end()), ", ")
- << maybe_replacing(env, ids, maybe_replacing_specs) << c::normal() << endl;
- cout << endl;
+ cout << fuc(fs_failed_action(),
+ fv<'a'>(action), fv<'i'>(join(indirect_iterator(ids->begin()), indirect_iterator(ids->end()), ", ")),
+ fv<'r'>(maybe_replacing(env, ids, maybe_replacing_specs)));
}
void set_output_manager(
@@ -587,7 +586,7 @@ namespace
if (*a == "world" || *a == "system" || *a == "security"
|| *a == "everything" || *a == "insecurity"
|| *a == "installed-packages" || *a == "installed-slots")
- cout << "* Special set '" << *a << "' does not belong in world" << endl;
+ cout << fuc(fs_special_set_world(), fv<'a'>(*a));
else
{
any = true;
@@ -639,9 +638,9 @@ namespace
else
{
if (removes)
- cout << "* Not removing '" << spec << "'" << endl;
+ cout << fuc(fs_not_removing_world(), fv<'a'>(stringify(spec)));
else
- cout << "* Not adding '" << spec << "'" << endl;
+ cout << fuc(fs_not_adding_world(), fv<'a'>(stringify(spec)));
}
}
}
@@ -661,7 +660,7 @@ namespace
if (cmdline.execution_options.a_preserve_world.specified() || cmdline.execution_options.a_fetch.specified())
return;
- cout << endl << c::bold_green() << "Updating world" << c::normal() << endl << endl;
+ cout << fuc(fs_updating_world());
update_world(env, cmdline, true);
update_world(env, cmdline, false);
@@ -1070,10 +1069,8 @@ namespace
{
AlreadyDoneVisitor v(env, counts);
job->accept(v);
- cout << endl;
- cout << c::bold_green() << v.x << " of " << v.y << ": Already " << state << " for "
- << v.text << "..." << c::normal() << endl;
- cout << endl;
+ cout << fuc(fs_already_action(), fv<'x'>(stringify(v.x)), fv<'y'>(stringify(v.y)),
+ fv<'s'>(state), fv<'t'>(v.text));
}
struct MakeJobID
@@ -1349,7 +1346,7 @@ namespace
{
if (heading != old_heading)
{
- cout << endl << c::bold_yellow() << heading << c::normal() << endl << endl;
+ cout << fuc(fs_output_heading(), fv<'h'>(heading));
old_heading = heading;
}
@@ -1359,9 +1356,9 @@ namespace
}
else
{
- cout << endl << c::bold_yellow() << heading << c::normal() << endl << endl;
+ cout << fuc(fs_output_heading(), fv<'h'>(heading));
old_heading = "";
- cout << "-> (no output for " << (Timestamp::now().seconds() - last_output.seconds()) << " seconds)" << endl;
+ cout << fuc(fs_no_output(), fv<'n'>(stringify(Timestamp::now().seconds() - last_output.seconds())));
}
last_flushed = Timestamp::now();
@@ -1571,22 +1568,20 @@ namespace
if (! done_heading)
{
done_heading = true;
- cout << endl << c::bold_blue() << "Summary:" << c::normal() << endl << endl;
+ cout << fuc(fs_summary_heading());
}
}
void visit(const JobActiveState &) const
{
need_heading();
- cout << c::bold_yellow() << "pending: " << job->accept_returning<std::string>(
- SummaryNameVisitor(env)) << c::normal() << endl;
+ cout << fuc(fs_summary_job_pending(), fv<'s'>(job->accept_returning<std::string>(SummaryNameVisitor(env))));
}
void visit(const JobPendingState &) const
{
need_heading();
- cout << c::bold_yellow() << "pending: " << job->accept_returning<std::string>(
- SummaryNameVisitor(env)) << c::normal() << endl;
+ cout << fuc(fs_summary_job_pending(), fv<'s'>(job->accept_returning<std::string>(SummaryNameVisitor(env))));
}
void visit(const JobSucceededState & s) const
@@ -1595,16 +1590,14 @@ namespace
|| (something_failed && ! simple_visitor_cast<const FetchJob>(*job)))
{
need_heading();
- cout << c::bold_green() << "succeeded: " << job->accept_returning<std::string>(
- SummaryNameVisitor(env)) << c::normal() << endl;
+ cout << fuc(fs_summary_job_succeeded(), fv<'s'>(job->accept_returning<std::string>(SummaryNameVisitor(env))));
}
}
void visit(const JobFailedState &) const
{
need_heading();
- cout << c::bold_red() << "failed: " << job->accept_returning<std::string>(
- SummaryNameVisitor(env)) << c::normal() << endl;
+ cout << fuc(fs_summary_job_failed(), fv<'s'>(job->accept_returning<std::string>(SummaryNameVisitor(env))));
}
void visit(const JobSkippedState &) const
@@ -1612,8 +1605,7 @@ namespace
if (! simple_visitor_cast<const FetchJob>(*job))
{
need_heading();
- cout << c::bold_yellow() << "skipped: " << job->accept_returning<std::string>(
- SummaryNameVisitor(env)) << c::normal() << endl;
+ cout << fuc(fs_summary_job_skipped(), fv<'s'>(job->accept_returning<std::string>(SummaryNameVisitor(env))));
}
}
};
diff --git a/src/clients/cave/cmd_print_formats.cc b/src/clients/cave/cmd_print_formats.cc
index 8da7c7a..ce96a9a 100644
--- a/src/clients/cave/cmd_print_formats.cc
+++ b/src/clients/cave/cmd_print_formats.cc
@@ -124,6 +124,8 @@ namespace
}{
#include "cmd_executables-fmt.hh"
}{
+#include "cmd_execute_resolution-fmt.hh"
+ }{
#include "cmd_fix_cache-fmt.hh"
}{
#include "cmd_info-fmt.hh"