summaryrefslogtreecommitdiff
path: root/ftparchive
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 /ftparchive
parent2b0660b537581e9e65180e4cf1a94d763fd66847 (diff)
downloadapt-011188e3920f21e6883c2dab956b3d4fb4e8cbfa.tar.gz
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 'ftparchive')
-rw-r--r--ftparchive/apt-ftparchive.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc
index ca03080ca..f53958ceb 100644
--- a/ftparchive/apt-ftparchive.cc
+++ b/ftparchive/apt-ftparchive.cc
@@ -605,9 +605,7 @@ static void LoadBinDir(vector<PackageMap> &PkgList,Configuration &Setup)
/*}}}*/
// ShowHelp - Show the help text /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-static bool ShowHelp(CommandLine &, CommandLine::DispatchWithHelp const *)
+bool ShowHelp(CommandLine &, CommandLine::DispatchWithHelp const *)
{
ioprintf(cout, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH);
if (_config->FindB("version") == true)
@@ -1025,11 +1023,9 @@ static bool Clean(CommandLine &CmdL)
}
/*}}}*/
-int main(int argc, const char *argv[])
+std::vector<CommandLine::DispatchWithHelp> GetCommands() /*{{{*/
{
- InitLocale();
-
- CommandLine::DispatchWithHelp Cmds[] = {
+ return {
{"packages",&SimpleGenPackages, nullptr},
{"contents",&SimpleGenContents, nullptr},
{"sources",&SimpleGenSources, nullptr},
@@ -1038,10 +1034,15 @@ int main(int argc, const char *argv[])
{"clean",&Clean, nullptr},
{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-ftparchive", &_config, NULL, argc, argv, ShowHelp);
+ auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT_FTPARCHIVE, &_config, NULL, argc, argv);
_config->CndSet("quiet",0);
Quiet = _config->FindI("quiet",0);
@@ -1049,3 +1050,4 @@ int main(int argc, const char *argv[])
return DispatchCommandLine(CmdL, Cmds);
}
+ /*}}}*/