summaryrefslogtreecommitdiff
path: root/cmdline/apt-config.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2015-10-25 23:45:09 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2015-11-04 18:04:04 +0100
commit011188e3920f21e6883c2dab956b3d4fb4e8cbfa (patch)
tree9649094789cf2369d82758e24995feb2b0bed59c /cmdline/apt-config.cc
parent2b0660b537581e9e65180e4cf1a94d763fd66847 (diff)
generate commands array after config is loaded
This ensures that location strings loaded from a location specified via configuration (Dir::Locale) effect the help messages for commands. Git-Dch: Ignore
Diffstat (limited to 'cmdline/apt-config.cc')
-rw-r--r--cmdline/apt-config.cc17
1 files changed, 9 insertions, 8 deletions
diff --git a/cmdline/apt-config.cc b/cmdline/apt-config.cc
index 3ccfa9a95..9d80e4ebf 100644
--- a/cmdline/apt-config.cc
+++ b/cmdline/apt-config.cc
@@ -77,9 +77,7 @@ static bool DoDump(CommandLine &CmdL)
}
/*}}}*/
// ShowHelp - Show the help screen /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-static bool ShowHelp(CommandLine &, CommandLine::DispatchWithHelp const * Cmds)
+bool ShowHelp(CommandLine &, CommandLine::DispatchWithHelp const * Cmds)
{
ioprintf(cout, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH);
if (_config->FindB("version") == true)
@@ -106,19 +104,22 @@ static bool ShowHelp(CommandLine &, CommandLine::DispatchWithHelp const * Cmds)
return true;
}
/*}}}*/
-int main(int argc,const char *argv[]) /*{{{*/
+std::vector<CommandLine::DispatchWithHelp> GetCommands() /*{{{*/
{
- InitLocale();
-
- CommandLine::DispatchWithHelp Cmds[] = {
+ return {
{"shell", &DoShell, _("get configuration values via shell evaluation")},
{"dump", &DoDump, _("show the active configuration setting")},
{nullptr, nullptr, nullptr}
};
+}
+ /*}}}*/
+int main(int argc,const char *argv[]) /*{{{*/
+{
+ InitLocale();
// Parse the command line and initialize the package library
CommandLine CmdL;
- ParseCommandLine(CmdL, Cmds, "apt-config", &_config, &_system, argc, argv, ShowHelp);
+ auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT_CONFIG, &_config, &_system, argc, argv);
std::vector<std::string> const langs = APT::Configuration::getLanguages(true);
_config->Clear("Acquire::Languages");