diff options
author | David Kalnischkies <david@kalnischkies.de> | 2015-10-25 23:45:09 +0100 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2015-11-04 18:04:04 +0100 |
commit | 011188e3920f21e6883c2dab956b3d4fb4e8cbfa (patch) | |
tree | 9649094789cf2369d82758e24995feb2b0bed59c /cmdline/apt-get.cc | |
parent | 2b0660b537581e9e65180e4cf1a94d763fd66847 (diff) | |
download | apt-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 'cmdline/apt-get.cc')
-rw-r--r-- | cmdline/apt-get.cc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 2a19360c8..fd7f045c6 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1527,9 +1527,7 @@ static bool DoIndexTargets(CommandLine &CmdL) } /*}}}*/ // ShowHelp - Show a 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); @@ -1613,11 +1611,9 @@ 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 { {"update", &DoUpdate, _("Retrieve new lists of packages")}, {"upgrade", &DoUpgrade, _("Perform an upgrade")}, {"install", &DoInstall, _("Install new packages (pkg is libc6 not libc6.deb)")}, @@ -1642,10 +1638,15 @@ int main(int argc,const char *argv[]) /*{{{*/ {"moo", &DoMoo, 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-get", &_config, &_system, argc, argv, ShowHelp); + auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT_GET, &_config, &_system, argc, argv); InitSignals(); InitOutput(); |