summaryrefslogtreecommitdiff
path: root/cmdline/apt-cache.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2015-10-22 16:28:54 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2015-11-04 18:04:03 +0100
commitcbbee23e7768750ca1c8b49bdfbf8a650131bbb6 (patch)
tree8727247578b43b0ae0a56110ff9e0e254157fc76 /cmdline/apt-cache.cc
parent995a4bf6d770a5cc824c38388909f23fcca558c3 (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-cache.cc')
-rw-r--r--cmdline/apt-cache.cc80
1 files changed, 35 insertions, 45 deletions
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc
index 24ed9eef3..4b3a74922 100644
--- a/cmdline/apt-cache.cc
+++ b/cmdline/apt-cache.cc
@@ -1522,41 +1522,30 @@ static bool GenCaches(CommandLine &)
}
/*}}}*/
// ShowHelp - Show a help screen /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-static bool ShowHelp(CommandLine &)
+static bool ShowHelp(CommandLine &, CommandLine::DispatchWithHelp const * Cmds)
{
ioprintf(cout, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH);
if (_config->FindB("version") == true)
return true;
- cout <<
+ std::cout <<
_("Usage: apt-cache [options] command\n"
- " apt-cache [options] showpkg pkg1 [pkg2 ...]\n"
- " apt-cache [options] showsrc pkg1 [pkg2 ...]\n"
+ " apt-cache [options] show pkg1 [pkg2 ...]\n"
"\n"
"apt-cache is a low-level tool used to query information\n"
- "from APT's binary cache files\n"
- "\n"
- "Commands:\n"
- " gencaches - Build both the package and source cache\n"
- " showpkg - Show some general information for a single package\n"
- " showsrc - Show source records\n"
- " stats - Show some basic statistics\n"
- " dump - Show the entire file in a terse form\n"
- " dumpavail - Print an available file to stdout\n"
- " unmet - Show unmet dependencies\n"
- " search - Search the package list for a regex pattern\n"
- " show - Show a readable record for the package\n"
- " depends - Show raw dependency information for a package\n"
- " rdepends - Show reverse dependency information for a package\n"
- " pkgnames - List the names of all packages in the system\n"
- " dotty - Generate package graphs for GraphViz\n"
- " xvcg - Generate package graphs for xvcg\n"
- " policy - Show policy settings\n"
- "\n"
- "Options:\n"
+ "from APT's binary cache files\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
+ << _("Options:\n"
" -h This help text.\n"
" -p=? The package cache.\n"
" -s=? The source cache.\n"
@@ -1570,25 +1559,26 @@ static bool ShowHelp(CommandLine &)
/*}}}*/
int main(int argc,const char *argv[]) /*{{{*/
{
- CommandLine::Dispatch Cmds[] = {{"help",&ShowHelp},
- {"gencaches",&GenCaches},
- {"showsrc",&ShowSrcPackage},
- {"showpkg",&DumpPackage},
- {"stats",&Stats},
- {"dump",&Dump},
- {"dumpavail",&DumpAvail},
- {"unmet",&UnMet},
- {"search",&DoSearch},
- {"depends",&Depends},
- {"rdepends",&RDepends},
- {"dotty",&Dotty},
- {"xvcg",&XVcg},
- {"show",&ShowPackage},
- {"pkgnames",&ShowPkgNames},
- {"showauto",&ShowAuto},
- {"policy",&Policy},
- {"madison",&Madison},
- {0,0}};
+ CommandLine::DispatchWithHelp Cmds[] = {
+ {"gencaches",&GenCaches, nullptr},
+ {"showsrc",&ShowSrcPackage, _("Show source records")},
+ {"showpkg",&DumpPackage, nullptr},
+ {"stats",&Stats, nullptr},
+ {"dump",&Dump, nullptr},
+ {"dumpavail",&DumpAvail, nullptr},
+ {"unmet",&UnMet, nullptr},
+ {"search",&DoSearch, _("Search the package list for a regex pattern")},
+ {"depends",&Depends, _("Show raw dependency information for a package")},
+ {"rdepends",&RDepends, _("Show reverse dependency information for a package")},
+ {"dotty",&Dotty, nullptr},
+ {"xvcg",&XVcg, nullptr},
+ {"show",&ShowPackage, _("Show a readable record for the package")},
+ {"pkgnames",&ShowPkgNames, _("List the names of all packages in the system")},
+ {"showauto",&ShowAuto, nullptr},
+ {"policy",&Policy, _("Show policy settings")},
+ {"madison",&Madison, nullptr},
+ {nullptr, nullptr, nullptr}
+ };
std::vector<CommandLine::Args> Args = getCommandArgs("apt-cache", CommandLine::GetCommand(Cmds, argc, argv));