aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-11 10:03:42 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-11 10:03:42 +0100
commit00bf3270a86db69703370b2a4ab9267b04dd4310 (patch)
treeea7663f1451559db83758288323f1ef9ecb28010
parentf7b0e96673665c71c518601ee257822163a47452 (diff)
downloadpaludis-00bf3270a86db69703370b2a4ab9267b04dd4310.tar.gz
paludis-00bf3270a86db69703370b2a4ab9267b04dd4310.tar.xz
Show whether world is changed
Fixes: ticket:902
-rw-r--r--src/clients/cave/cmd_execute_resolution.cc7
-rw-r--r--src/clients/cave/cmd_update_world.cc41
2 files changed, 36 insertions, 12 deletions
diff --git a/src/clients/cave/cmd_execute_resolution.cc b/src/clients/cave/cmd_execute_resolution.cc
index 1d3f66c..7e0260d 100644
--- a/src/clients/cave/cmd_execute_resolution.cc
+++ b/src/clients/cave/cmd_execute_resolution.cc
@@ -500,7 +500,7 @@ namespace
{
std::string command(cmdline.program_options.a_update_world_program.argument());
if (command.empty())
- command = "$CAVE update-world";
+ command = "$CAVE update-world --verbose";
if (removes)
command.append(" --remove");
@@ -523,7 +523,6 @@ namespace
else
{
any = true;
- cout << "* Adding '" << *a << "'" << endl;
command.append(" " + *a);
}
}
@@ -567,10 +566,6 @@ namespace
)))
{
any = true;
- if (removes)
- cout << "* Removing '" << spec << "'" << endl;
- else
- cout << "* Adding '" << spec << "'" << endl;
command.append(" " + stringify(spec));
}
else
diff --git a/src/clients/cave/cmd_update_world.cc b/src/clients/cave/cmd_update_world.cc
index 2a18e73..1063e32 100644
--- a/src/clients/cave/cmd_update_world.cc
+++ b/src/clients/cave/cmd_update_world.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2009 Ciaran McCreesh
+ * Copyright (c) 2009, 2010 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -58,11 +58,17 @@ namespace
return "Adds or removes items from the world set.";
}
+ args::ArgsGroup g_output_options;
+ args::SwitchArg a_verbose;
+
args::ArgsGroup g_update_options;
args::SwitchArg a_remove;
args::SwitchArg a_set;
UpdateWorldCommandLine() :
+ g_output_options(main_options_section(), "Output Options", "Alter the output."),
+ a_verbose(&g_output_options, "verbose", '\0', "Produce verbose output", true),
+
g_update_options(main_options_section(), "Update Options", "Alter how updates are performed."),
a_remove(&g_update_options, "remove", 'r', "Remove the specified items instead of adding them", true),
a_set(&g_update_options, "set", 's', "The parameters are set names, not package names", true)
@@ -95,12 +101,16 @@ UpdateWorldCommand::run(
p_end(cmdline.end_parameters()) ;
p != p_end ; ++p)
{
+ bool result(false);
+ std::string name;
+
if (cmdline.a_set.specified())
{
+ name = *p;
if (cmdline.a_remove.specified())
- env->remove_from_world(SetName(*p));
+ result = env->remove_from_world(SetName(*p));
else
- env->add_to_world(SetName(*p));
+ result = env->add_to_world(SetName(*p));
}
else
{
@@ -111,10 +121,30 @@ UpdateWorldCommand::run(
else
q = QualifiedPackageName(*p);
+ name = stringify(q);
+
+ if (cmdline.a_remove.specified())
+ result = env->remove_from_world(q);
+ else
+ result = env->add_to_world(q);
+ }
+
+ if (cmdline.a_verbose.specified())
+ {
if (cmdline.a_remove.specified())
- env->remove_from_world(q);
+ {
+ if (result)
+ cout << "* Removed '" << name << "'" << endl;
+ else
+ cout << "* Did not remove '" << name << "'" << endl;
+ }
else
- env->add_to_world(q);
+ {
+ if (result)
+ cout << "* Added '" << name << "'" << endl;
+ else
+ cout << "* Did not need to add '" << name << "'" << endl;
+ }
}
}
@@ -127,4 +157,3 @@ UpdateWorldCommand::make_doc_cmdline()
return make_shared_ptr(new UpdateWorldCommandLine);
}
-