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-sortpkgs.cc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'cmdline/apt-sortpkgs.cc') diff --git a/cmdline/apt-sortpkgs.cc b/cmdline/apt-sortpkgs.cc index 93aa5a76b..82c9c333d 100644 --- a/cmdline/apt-sortpkgs.cc +++ b/cmdline/apt-sortpkgs.cc @@ -133,9 +133,7 @@ static bool DoIt(string InFile) } /*}}}*/ // ShowHelp - Show the 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); if (_config->FindB("version") == true) @@ -156,20 +154,25 @@ static bool ShowHelp(CommandLine &, CommandLine::DispatchWithHelp const *) return true; } /*}}}*/ +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-sortpkgs", &_config, &_system, argc, argv, ShowHelp); + ParseCommandLine(CmdL, APT_CMD::APT_SORTPKG, &_config, &_system, argc, argv); // Match the operation for (unsigned int I = 0; I != CmdL.FileSize(); I++) if (DoIt(CmdL.FileList[I]) == false) break; - return DispatchCommandLine(CmdL, nullptr); + return DispatchCommandLine(CmdL, {}); } /*}}}*/ -- cgit v1.2.3