summaryrefslogtreecommitdiff
path: root/cmdline/apt-sortpkgs.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-sortpkgs.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-sortpkgs.cc')
-rw-r--r--cmdline/apt-sortpkgs.cc17
1 files changed, 10 insertions, 7 deletions
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<CommandLine::DispatchWithHelp> 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, {});
}
/*}}}*/