diff options
author | David Kalnischkies <david@kalnischkies.de> | 2015-10-22 16:28:54 +0200 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2015-11-04 18:04:03 +0100 |
commit | cbbee23e7768750ca1c8b49bdfbf8a650131bbb6 (patch) | |
tree | 8727247578b43b0ae0a56110ff9e0e254157fc76 /cmdline/apt-helper.cc | |
parent | 995a4bf6d770a5cc824c38388909f23fcca558c3 (diff) |
split up help messages for simpler reuse
That is one huge commit with busy work only: Help messages used to be
one big translateable string, which is a pain for translators and hard
to reuse for us. This change there 'explodes' this single string into
new string for each documented string trying hard to split up the
translated messages as well. This actually restores many translations as
previously adding a single command made all of the bug message fuzzy.
The splitup also highlighted that its easy to forget a line, duplicate
one and similar stuff.
Git-Dch: Ignore
Diffstat (limited to 'cmdline/apt-helper.cc')
-rw-r--r-- | cmdline/apt-helper.cc | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/cmdline/apt-helper.cc b/cmdline/apt-helper.cc index dc4efb32b..3df858813 100644 --- a/cmdline/apt-helper.cc +++ b/cmdline/apt-helper.cc @@ -106,7 +106,7 @@ static bool DoSrvLookup(CommandLine &CmdL) return true; } -static bool ShowHelp(CommandLine &) +static bool ShowHelp(CommandLine &, CommandLine::DispatchWithHelp const * Cmds) { ioprintf(std::cout, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH); @@ -117,28 +117,34 @@ static bool ShowHelp(CommandLine &) _("Usage: apt-helper [options] command\n" " apt-helper [options] download-file uri target-path\n" "\n" - "apt-helper is a internal helper for apt\n" - "\n" - "Commands:\n" - " download-file - download the given uri to the target-path\n" - " srv-lookup - lookup a SRV record (e.g. _http._tcp.ftp.debian.org)\n" - " auto-detect-proxy - detect proxy using apt.conf\n" - "\n" - " This APT helper has Super Meep Powers.\n"); + "apt-helper is a internal helper for apt\n") + << std::endl + << _("Commands:") << std::endl; + + for (; Cmds->Handler != nullptr; ++Cmds) + { + if (Cmds->Help == nullptr) + continue; + std::cout << " " << Cmds->Match << " - " << Cmds->Help << std::endl; + } + + std::cout << std::endl << + _("This APT helper has Super Meep Powers.") << std::endl; return true; } int main(int argc,const char *argv[]) /*{{{*/ { - CommandLine::Dispatch Cmds[] = {{"help",&ShowHelp}, - {"download-file", &DoDownloadFile}, - {"srv-lookup", &DoSrvLookup}, - {"auto-detect-proxy", &DoAutoDetectProxy}, - {0,0}}; + CommandLine::DispatchWithHelp Cmds[] = { + {"download-file", &DoDownloadFile, _("download the given uri to the target-path")}, + {"srv-lookup", &DoSrvLookup, _("lookup a SRV record (e.g. _http._tcp.ftp.debian.org)")}, + {"auto-detect-proxy", &DoAutoDetectProxy, _("detect proxy using apt.conf")}, + {nullptr, nullptr, nullptr} + }; std::vector<CommandLine::Args> Args = getCommandArgs( - "apt-download", CommandLine::GetCommand(Cmds, argc, argv)); + "apt-helper", CommandLine::GetCommand(Cmds, argc, argv)); // Set up gettext support setlocale(LC_ALL,""); |