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-mark.cc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'cmdline/apt-mark.cc') diff --git a/cmdline/apt-mark.cc b/cmdline/apt-mark.cc index 0a5bb164a..c49476c7c 100644 --- a/cmdline/apt-mark.cc +++ b/cmdline/apt-mark.cc @@ -281,7 +281,7 @@ static bool ShowSelection(CommandLine &CmdL) /*{{{*/ } /*}}}*/ // ShowHelp - Show a help screen /*{{{*/ -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); @@ -314,11 +314,9 @@ static bool ShowHelp(CommandLine &, CommandLine::DispatchWithHelp const * Cmds) return true; } /*}}}*/ -int main(int argc,const char *argv[]) /*{{{*/ +std::vector GetCommands() /*{{{*/ { - InitLocale(); - - CommandLine::DispatchWithHelp Cmds[] = { + return { {"auto",&DoAuto, _("Mark the given packages as automatically installed")}, {"manual",&DoAuto, _("Mark the given packages as manually installed")}, {"hold",&DoSelection, _("Mark a package as held back")}, @@ -339,9 +337,14 @@ int main(int argc,const char *argv[]) /*{{{*/ {"unmarkauto", &DoMarkAuto, nullptr}, {nullptr, nullptr, nullptr} }; +} + /*}}}*/ +int main(int argc,const char *argv[]) /*{{{*/ +{ + InitLocale(); CommandLine CmdL; - ParseCommandLine(CmdL, Cmds, "apt-mark", &_config, &_system, argc, argv, ShowHelp); + auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT_MARK, &_config, &_system, argc, argv); InitOutput(); -- cgit v1.2.3