aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-06 14:25:24 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-06 14:25:24 +0000
commit693dcdacb0bf361a6eb53f8de107125f8c91c952 (patch)
treeac60dcebc9480e641bcaadaf92d623d1c7eee1fa
parent55d3eb16c274301b179336a1354e85fc6edd7bc7 (diff)
downloadpaludis-693dcdacb0bf361a6eb53f8de107125f8c91c952.tar.gz
paludis-693dcdacb0bf361a6eb53f8de107125f8c91c952.tar.xz
Avoid instantiating defaultconfig for listing sync protocols etc
-rw-r--r--src/paludis.cc62
1 files changed, 31 insertions, 31 deletions
diff --git a/src/paludis.cc b/src/paludis.cc
index d88c394..bdfd8e8 100644
--- a/src/paludis.cc
+++ b/src/paludis.cc
@@ -28,6 +28,7 @@
#include <paludis/util/util.hh>
#include <iostream>
+#include <string>
#include <cstdlib>
/** \file
@@ -74,21 +75,6 @@ main(int argc, char *argv[])
else
throw DoHelp("bad value for --log-level");
- if (CommandLine::get_instance()->a_config_suffix.specified())
- {
- p::DefaultConfig::set_config_suffix(CommandLine::get_instance()->a_config_suffix.argument());
- p::DefaultConfig::get_instance()->set_paludis_command(
- std::string(argv[0]) + " --config-suffix " +
- CommandLine::get_instance()->a_config_suffix.argument());
- }
- else
- p::DefaultConfig::get_instance()->set_paludis_command(std::string(argv[0]));
-
- if (CommandLine::get_instance()->a_log_level.specified())
- p::DefaultConfig::get_instance()->set_paludis_command(
- p::DefaultConfig::get_instance()->paludis_command() + " --log-level " +
- CommandLine::get_instance()->a_log_level.argument());
-
if (1 != (CommandLine::get_instance()->a_query.specified() +
CommandLine::get_instance()->a_version.specified() +
CommandLine::get_instance()->a_install.specified() +
@@ -124,6 +110,36 @@ main(int argc, char *argv[])
throw DoHelp("you should specify exactly one action");
}
+ /* these actions don't need DefaultConfig */
+
+ if (CommandLine::get_instance()->a_list_sync_protocols.specified())
+ {
+ if (! CommandLine::get_instance()->empty())
+ throw DoHelp("list-sync-protocols action takes no parameters");
+
+ return do_list_sync_protocols();
+ }
+
+ if (CommandLine::get_instance()->a_list_repository_formats.specified())
+ {
+ if (! CommandLine::get_instance()->empty())
+ throw DoHelp("list-repository-formats action takes no parameters");
+
+ return do_list_repository_formats();
+ }
+
+ /* these actions do need DefaultConfig */
+
+ std::string paludis_command(argv[0]);
+ if (CommandLine::get_instance()->a_config_suffix.specified())
+ {
+ p::DefaultConfig::set_config_suffix(CommandLine::get_instance()->a_config_suffix.argument());
+ paludis_command.append(" --config-suffix " +
+ CommandLine::get_instance()->a_config_suffix.argument());
+ }
+ paludis_command.append(" --log-level " + CommandLine::get_instance()->a_log_level.argument());
+ p::DefaultConfig::get_instance()->set_paludis_command(paludis_command);
+
if (CommandLine::get_instance()->a_query.specified())
{
if (CommandLine::get_instance()->empty())
@@ -181,22 +197,6 @@ main(int argc, char *argv[])
return do_list_packages();
}
- if (CommandLine::get_instance()->a_list_sync_protocols.specified())
- {
- if (! CommandLine::get_instance()->empty())
- throw DoHelp("list-sync-protocols action takes no parameters");
-
- return do_list_sync_protocols();
- }
-
- if (CommandLine::get_instance()->a_list_repository_formats.specified())
- {
- if (! CommandLine::get_instance()->empty())
- throw DoHelp("list-repository-formats action takes no parameters");
-
- return do_list_repository_formats();
- }
-
if (CommandLine::get_instance()->a_has_version.specified())
{
if (1 != std::distance(CommandLine::get_instance()->begin_parameters(),