aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-14 11:22:32 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-16 11:08:45 +0100
commitad8c652af2f9a0ed9d75783bf8771c5caf7a75fb (patch)
tree0c43ab70dd1131b7dd230c6b27738adcc28250cf
parenta80e13f8e186601b0bcbf626f21bfb73ac41bfaf (diff)
downloadpaludis-ad8c652af2f9a0ed9d75783bf8771c5caf7a75fb.tar.gz
paludis-ad8c652af2f9a0ed9d75783bf8771c5caf7a75fb.tar.xz
cave perform --output-exclusivity
-rw-r--r--src/clients/cave/cmd_perform.cc26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/clients/cave/cmd_perform.cc b/src/clients/cave/cmd_perform.cc
index 3dc8c20..c9dec31 100644
--- a/src/clients/cave/cmd_perform.cc
+++ b/src/clients/cave/cmd_perform.cc
@@ -81,6 +81,7 @@ namespace
args::SwitchArg a_hooks;
args::StringArg a_x_of_y;
args::SwitchArg a_managed_output;
+ args::EnumArg a_output_exclusivity;
args::ArgsGroup g_fetch_action_options;
args::SwitchArg a_exclude_unmirrorable;
@@ -113,6 +114,14 @@ namespace
a_managed_output(&g_general_options, "managed-output", '\0',
"Specify that our output is being managed by another process. Used by "
"'cave execute-resolution'; not for end user use.", false),
+ a_output_exclusivity(&g_general_options, "output-exclusivity", '\0',
+ "Specify the exclusivity of our output. Should not be changed unless "
+ "--managed-output is also specified",
+ args::EnumArg::EnumArgOptions
+ ("exclusive", "Exclusive output")
+ ("with-others", "With others")
+ ("background", "Backgrounded"),
+ "exclusive"),
g_fetch_action_options(main_options_section(), "Fetch Action Options",
"Options for if the action is 'fetch' or 'pretend-fetch'"),
@@ -162,6 +171,19 @@ namespace
}
};
+ OutputExclusivity get_output_exclusivity(const PerformCommandLine & cmdline)
+ {
+ if (cmdline.a_output_exclusivity.argument() == "exclusive")
+ return oe_exclusive;
+ if (cmdline.a_output_exclusivity.argument() == "with-others")
+ return oe_with_others;
+ if (cmdline.a_output_exclusivity.argument() == "background")
+ return oe_background;
+ throw args::DoHelp("Don't understand argument '"
+ + cmdline.a_output_exclusivity.argument() + "' to '--"
+ + cmdline.a_output_exclusivity.long_name() + "'");
+ }
+
struct OutputManagerFromIPCOrEnvironment
{
std::tr1::shared_ptr<OutputManagerFromIPC> manager_if_ipc;
@@ -173,10 +195,10 @@ namespace
const std::tr1::shared_ptr<const PackageID> & id)
{
if (cmdline.a_managed_output.specified())
- manager_if_ipc.reset(new OutputManagerFromIPC(e, id, oe_exclusive,
+ manager_if_ipc.reset(new OutputManagerFromIPC(e, id, get_output_exclusivity(cmdline),
ClientOutputFeatures() + cof_summary_at_end));
else
- manager_if_env.reset(new OutputManagerFromEnvironment(e, id, oe_exclusive,
+ manager_if_env.reset(new OutputManagerFromEnvironment(e, id, get_output_exclusivity(cmdline),
ClientOutputFeatures() + cof_summary_at_end));
}