From 011188e3920f21e6883c2dab956b3d4fb4e8cbfa Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 25 Oct 2015 23:45:09 +0100 Subject: 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 --- cmdline/apt-extracttemplates.cc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'cmdline/apt-extracttemplates.cc') diff --git a/cmdline/apt-extracttemplates.cc b/cmdline/apt-extracttemplates.cc index e28b42870..c5c37d122 100644 --- a/cmdline/apt-extracttemplates.cc +++ b/cmdline/apt-extracttemplates.cc @@ -216,9 +216,7 @@ bool DebFile::ParseInfo() } /*}}}*/ // ShowHelp - show a short help text /*{{{*/ -// --------------------------------------------------------------------- -/* */ -static bool ShowHelp(CommandLine &, CommandLine::DispatchWithHelp const *) +bool ShowHelp(CommandLine &, CommandLine::DispatchWithHelp const *) { ioprintf(std::cout, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH); @@ -343,17 +341,22 @@ static bool Go(CommandLine &CmdL) return !_error->PendingError(); } /*}}}*/ +std::vector GetCommands() /*{{{*/ +{ + return { + {nullptr, nullptr, nullptr} + }; +} + /*}}}*/ int main(int argc, const char **argv) /*{{{*/ { InitLocale(); - // Parse the command line and initialize the package library - CommandLine::DispatchWithHelp Cmds[] = {{nullptr, nullptr, nullptr}}; CommandLine CmdL; - ParseCommandLine(CmdL, Cmds, "apt-extracttemplates", &_config, &_system, argc, argv, ShowHelp); + auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT_EXTRACTTEMPLATES, &_config, &_system, argc, argv); Go(CmdL); - return DispatchCommandLine(CmdL, nullptr); + return DispatchCommandLine(CmdL, {}); } /*}}}*/ -- cgit v1.2.3