summaryrefslogtreecommitdiff
path: root/cmdline/apt.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.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.cc')
-rw-r--r--cmdline/apt.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/cmdline/apt.cc b/cmdline/apt.cc
index eb16b561c..e32a9f1e3 100644
--- a/cmdline/apt.cc
+++ b/cmdline/apt.cc
@@ -37,7 +37,7 @@
#include <apti18n.h>
/*}}}*/
-static bool ShowHelp(CommandLine &, CommandLine::DispatchWithHelp const * Cmds)
+bool ShowHelp(CommandLine &, CommandLine::DispatchWithHelp const * Cmds)/*{{{*/
{
ioprintf(std::cout, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH);
@@ -57,12 +57,10 @@ 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 {
// query
{"list", &DoList, _("list packages based on package names")},
{"search", &DoSearch, _("search in package descriptions")},
@@ -86,9 +84,14 @@ int main(int argc, const char *argv[]) /*{{{*/
{"moo", &DoMoo, nullptr},
{nullptr, nullptr, nullptr}
};
+}
+ /*}}}*/
+int main(int argc, const char *argv[]) /*{{{*/
+{
+ InitLocale();
CommandLine CmdL;
- ParseCommandLine(CmdL, Cmds, "apt", &_config, &_system, argc, argv, ShowHelp);
+ auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT, &_config, &_system, argc, argv);
int const quiet = _config->FindI("quiet", 0);
if (quiet == 2)