summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/apt-cache.cc80
-rw-r--r--cmdline/apt-cdrom.cc41
-rw-r--r--cmdline/apt-config.cc38
-rw-r--r--cmdline/apt-extracttemplates.cc4
-rw-r--r--cmdline/apt-get.cc87
-rw-r--r--cmdline/apt-helper.cc36
-rw-r--r--cmdline/apt-internal-solver.cc4
-rw-r--r--cmdline/apt-mark.cc72
-rw-r--r--cmdline/apt-sortpkgs.cc4
-rw-r--r--cmdline/apt.cc83
10 files changed, 219 insertions, 230 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));
diff --git a/cmdline/apt-cdrom.cc b/cmdline/apt-cdrom.cc
index dcc784746..1838a76fe 100644
--- a/cmdline/apt-cdrom.cc
+++ b/cmdline/apt-cdrom.cc
@@ -203,25 +203,30 @@ static bool DoIdent(CommandLine &)
}
/*}}}*/
// ShowHelp - Show the 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 <<
- "Usage: apt-cdrom [options] command\n"
+
+ std::cout <<
+ _("Usage: apt-cdrom [options] command\n"
"\n"
"apt-cdrom is a tool to add CDROM's to APT's source list. The\n"
- "CDROM mount point and device information is taken from apt.conf\n"
- "and /etc/fstab.\n"
- "\n"
- "Commands:\n"
- " add - Add a CDROM\n"
- " ident - Report the identity of a CDROM\n"
- "\n"
- "Options:\n"
+ "CDROM mount point and device information is taken from apt.conf,\n"
+ "udev and /etc/fstab.\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"
" -d CD-ROM mount point\n"
" -r Rename a recognized CD-ROM\n"
@@ -231,17 +236,17 @@ static bool ShowHelp(CommandLine &)
" --no-auto-detect Do not try to auto detect drive and mount point\n"
" -c=? Read this configuration file\n"
" -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp\n"
- "See fstab(5)\n";
+ "See fstab(5)\n");
return true;
}
/*}}}*/
int main(int argc,const char *argv[]) /*{{{*/
{
- CommandLine::Dispatch Cmds[] = {
- {"add",&DoAdd},
- {"ident",&DoIdent},
- {"help",&ShowHelp},
- {0,0}};
+ CommandLine::DispatchWithHelp Cmds[] = {
+ {"add", &DoAdd, "Add a CDROM"},
+ {"ident", &DoIdent, "Report the identity of a CDROM"},
+ {nullptr, nullptr, nullptr}
+ };
std::vector<CommandLine::Args> Args = getCommandArgs("apt-cdrom", CommandLine::GetCommand(Cmds, argc, argv));
diff --git a/cmdline/apt-config.cc b/cmdline/apt-config.cc
index 4479b84a7..e0383e019 100644
--- a/cmdline/apt-config.cc
+++ b/cmdline/apt-config.cc
@@ -78,34 +78,40 @@ static bool DoDump(CommandLine &CmdL)
// ShowHelp - Show the 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 <<
- _("Usage: apt-config [options] command\n"
+ std::cout <<
+ _("Usage: apt-config [options] command\n"
"\n"
- "apt-config is a simple tool to read the APT config file\n"
- "\n"
- "Commands:\n"
- " shell - Shell mode\n"
- " dump - Show the configuration\n"
- "\n"
- "Options:\n"
- " -h This help text.\n"
- " -c=? Read this configuration file\n"
+ "apt-config is a simple tool to read the APT config file\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"
+ " -c=? Read this configuration file\n"
" -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp\n");
return true;
}
/*}}}*/
int main(int argc,const char *argv[]) /*{{{*/
{
- CommandLine::Dispatch Cmds[] = {{"shell",&DoShell},
- {"dump",&DoDump},
- {"help",&ShowHelp},
- {0,0}};
+ CommandLine::DispatchWithHelp Cmds[] = {
+ {"shell", &DoShell, _("get configuration values via shell evaluation")},
+ {"dump", &DoDump, _("show the active configuration setting")},
+ {nullptr, nullptr, nullptr}
+ };
std::vector<CommandLine::Args> Args = getCommandArgs("apt-config", CommandLine::GetCommand(Cmds, argc, argv));
diff --git a/cmdline/apt-extracttemplates.cc b/cmdline/apt-extracttemplates.cc
index 3e4f89286..cd52cfe33 100644
--- a/cmdline/apt-extracttemplates.cc
+++ b/cmdline/apt-extracttemplates.cc
@@ -217,7 +217,7 @@ bool DebFile::ParseInfo()
// ShowHelp - show a short help text /*{{{*/
// ---------------------------------------------------------------------
/* */
-static bool ShowHelp(CommandLine &)
+static bool ShowHelp(CommandLine &, CommandLine::DispatchWithHelp const *)
{
ioprintf(std::cout, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH);
@@ -357,7 +357,7 @@ int main(int argc, const char **argv) /*{{{*/
textdomain(PACKAGE);
// Parse the command line and initialize the package library
- CommandLine::Dispatch Cmds[] = {{NULL, NULL}};
+ CommandLine::DispatchWithHelp Cmds[] = {{nullptr, nullptr, nullptr}};
CommandLine CmdL;
ParseCommandLine(CmdL, Cmds, Args, &_config, &_system, argc, argv, ShowHelp);
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index cef7d8c14..be5bc0851 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -1536,7 +1536,7 @@ static bool DoIndexTargets(CommandLine &CmdL)
// 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);
@@ -1581,34 +1581,26 @@ static bool ShowHelp(CommandLine &)
return true;
}
-
- cout <<
+
+ std::cout <<
_("Usage: apt-get [options] command\n"
" apt-get [options] install|remove pkg1 [pkg2 ...]\n"
" apt-get [options] source pkg1 [pkg2 ...]\n"
"\n"
"apt-get is a simple command line interface for downloading and\n"
"installing packages. The most frequently used commands are update\n"
- "and install.\n"
- "\n"
- "Commands:\n"
- " update - Retrieve new lists of packages\n"
- " upgrade - Perform an upgrade\n"
- " install - Install new packages (pkg is libc6 not libc6.deb)\n"
- " remove - Remove packages\n"
- " autoremove - Remove automatically all unused packages\n"
- " purge - Remove packages and config files\n"
- " source - Download source archives\n"
- " build-dep - Configure build-dependencies for source packages\n"
- " dist-upgrade - Distribution upgrade, see apt-get(8)\n"
- " dselect-upgrade - Follow dselect selections\n"
- " clean - Erase downloaded archive files\n"
- " autoclean - Erase old downloaded archive files\n"
- " check - Verify that there are no broken dependencies\n"
- " changelog - Download and display the changelog for the given package\n"
- " download - Download the binary package into the current directory\n"
- "\n"
- "Options:\n"
+ "and install.\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"
" -q Loggable output - no progress indicator\n"
" -qq No output except for errors\n"
@@ -1630,30 +1622,31 @@ static bool ShowHelp(CommandLine &)
/*}}}*/
int main(int argc,const char *argv[]) /*{{{*/
{
- CommandLine::Dispatch Cmds[] = {{"update",&DoUpdate},
- {"upgrade",&DoUpgrade},
- {"install",&DoInstall},
- {"remove",&DoInstall},
- {"purge",&DoInstall},
- {"autoremove",&DoInstall},
- {"auto-remove",&DoInstall},
- {"markauto",&DoMarkAuto},
- {"unmarkauto",&DoMarkAuto},
- {"dist-upgrade",&DoDistUpgrade},
- {"full-upgrade",&DoDistUpgrade},
- {"dselect-upgrade",&DoDSelectUpgrade},
- {"build-dep",&DoBuildDep},
- {"clean",&DoClean},
- {"autoclean",&DoAutoClean},
- {"auto-clean",&DoAutoClean},
- {"check",&DoCheck},
- {"source",&DoSource},
- {"download",&DoDownload},
- {"changelog",&DoChangelog},
- {"indextargets",&DoIndexTargets},
- {"moo",&DoMoo},
- {"help",&ShowHelp},
- {0,0}};
+ CommandLine::DispatchWithHelp Cmds[] = {
+ {"update", &DoUpdate, _("Retrieve new lists of packages")},
+ {"upgrade", &DoUpgrade, _("Perform an upgrade")},
+ {"install", &DoInstall, _("Install new packages (pkg is libc6 not libc6.deb)")},
+ {"remove", &DoInstall, _("Remove packages")},
+ {"purge", &DoInstall, _("Remove packages and config files")},
+ {"autoremove", &DoInstall, _("Remove automatically all unused packages")},
+ {"auto-remove", &DoInstall, nullptr},
+ {"markauto", &DoMarkAuto, nullptr},
+ {"unmarkauto", &DoMarkAuto, nullptr},
+ {"dist-upgrade", &DoDistUpgrade, _("Distribution upgrade, see apt-get(8)")},
+ {"full-upgrade", &DoDistUpgrade, nullptr},
+ {"dselect-upgrade", &DoDSelectUpgrade, _("Follow dselect selections")},
+ {"build-dep", &DoBuildDep, _("Configure build-dependencies for source packages")},
+ {"clean", &DoClean, _("Erase downloaded archive files")},
+ {"autoclean", &DoAutoClean, _("Erase old downloaded archive files")},
+ {"auto-clean", &DoAutoClean, nullptr},
+ {"check", &DoCheck, _("Verify that there are no broken dependencies")},
+ {"source", &DoSource, _("Download source archives")},
+ {"download", &DoDownload, _("Download the binary package into the current directory")},
+ {"changelog", &DoChangelog, _("Download and display the changelog for the given package")},
+ {"indextargets", &DoIndexTargets, nullptr},
+ {"moo", &DoMoo, nullptr},
+ {nullptr, nullptr, nullptr}
+ };
std::vector<CommandLine::Args> Args = getCommandArgs("apt-get", CommandLine::GetCommand(Cmds, argc, argv));
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,"");
diff --git a/cmdline/apt-internal-solver.cc b/cmdline/apt-internal-solver.cc
index 258b42ccb..fbcbf07e9 100644
--- a/cmdline/apt-internal-solver.cc
+++ b/cmdline/apt-internal-solver.cc
@@ -43,7 +43,7 @@
// ShowHelp - Show a help screen /*{{{*/
// ---------------------------------------------------------------------
/* */
-static bool ShowHelp(CommandLine &) {
+static bool ShowHelp(CommandLine &, CommandLine::DispatchWithHelp const *) {
ioprintf(std::cout, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH);
std::cout <<
@@ -81,7 +81,7 @@ int main(int argc,const char *argv[]) /*{{{*/
DropPrivileges();
CommandLine CmdL;
- ParseCommandLine(CmdL, NULL, Args, &_config, NULL, argc, argv, ShowHelp);
+ ParseCommandLine(CmdL, nullptr, Args, &_config, NULL, argc, argv, ShowHelp);
if (CmdL.FileList[0] != 0 && strcmp(CmdL.FileList[0], "scenario") == 0)
{
diff --git a/cmdline/apt-mark.cc b/cmdline/apt-mark.cc
index 6080c7ea3..361d4e553 100644
--- a/cmdline/apt-mark.cc
+++ b/cmdline/apt-mark.cc
@@ -280,28 +280,27 @@ static bool ShowSelection(CommandLine &CmdL) /*{{{*/
}
/*}}}*/
// ShowHelp - Show a help screen /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-static bool ShowHelp(CommandLine &)
+static bool ShowHelp(CommandLine &, CommandLine::DispatchWithHelp const * Cmds)
{
ioprintf(std::cout, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH);
- cout <<
+ std::cout <<
_("Usage: apt-mark [options] {auto|manual} pkg1 [pkg2 ...]\n"
"\n"
"apt-mark is a simple command line interface for marking packages\n"
- "as manually or automatically installed. It can also list marks.\n"
- "\n"
- "Commands:\n"
- " auto - Mark the given packages as automatically installed\n"
- " manual - Mark the given packages as manually installed\n"
- " hold - Mark a package as held back\n"
- " unhold - Unset a package set as held back\n"
- " showauto - Print the list of automatically installed packages\n"
- " showmanual - Print the list of manually installed packages\n"
- " showhold - Print the list of package on hold\n"
- "\n"
- "Options:\n"
+ "as manually or automatically installed. It can also list marks.\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"
" -q Loggable output - no progress indicator\n"
" -qq No output except for errors\n"
@@ -316,26 +315,27 @@ static bool ShowHelp(CommandLine &)
/*}}}*/
int main(int argc,const char *argv[]) /*{{{*/
{
- CommandLine::Dispatch Cmds[] = {{"help",&ShowHelp},
- {"auto",&DoAuto},
- {"manual",&DoAuto},
- {"hold",&DoSelection},
- {"unhold",&DoSelection},
- {"install",&DoSelection},
- {"remove",&DoSelection}, // dpkg uses deinstall, but we use remove everywhere else
- {"deinstall",&DoSelection},
- {"purge",&DoSelection},
- {"showauto",&ShowAuto},
- {"showmanual",&ShowAuto},
- {"showhold",&ShowSelection}, {"showholds",&ShowSelection},
- {"showinstall",&ShowSelection}, {"showinstalls",&ShowSelection},
- {"showdeinstall",&ShowSelection}, {"showdeinstalls",&ShowSelection},
- {"showremove",&ShowSelection}, {"showremoves",&ShowSelection},
- {"showpurge",&ShowSelection}, {"showpurges",&ShowSelection},
- // obsolete commands for compatibility
- {"markauto", &DoMarkAuto},
- {"unmarkauto", &DoMarkAuto},
- {0,0}};
+ CommandLine::DispatchWithHelp Cmds[] = {
+ {"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")},
+ {"unhold",&DoSelection, _("Unset a package set as held back")},
+ {"install",&DoSelection, nullptr},
+ {"remove",&DoSelection, nullptr}, // dpkg uses deinstall, but we use remove everywhere else
+ {"deinstall",&DoSelection, nullptr},
+ {"purge",&DoSelection, nullptr},
+ {"showauto",&ShowAuto, _("Print the list of automatically installed packages")},
+ {"showmanual",&ShowAuto, _("Print the list of manually installed packages")},
+ {"showhold",&ShowSelection, _("Print the list of package on hold")}, {"showholds",&ShowSelection, nullptr},
+ {"showinstall",&ShowSelection, nullptr}, {"showinstalls",&ShowSelection, nullptr},
+ {"showdeinstall",&ShowSelection, nullptr}, {"showdeinstalls",&ShowSelection, nullptr},
+ {"showremove",&ShowSelection, nullptr}, {"showremoves",&ShowSelection, nullptr},
+ {"showpurge",&ShowSelection, nullptr}, {"showpurges",&ShowSelection, nullptr},
+ // obsolete commands for compatibility
+ {"markauto", &DoMarkAuto, nullptr},
+ {"unmarkauto", &DoMarkAuto, nullptr},
+ {nullptr, nullptr, nullptr}
+ };
std::vector<CommandLine::Args> Args = getCommandArgs("apt-mark", CommandLine::GetCommand(Cmds, argc, argv));
diff --git a/cmdline/apt-sortpkgs.cc b/cmdline/apt-sortpkgs.cc
index cde3069bd..e3d520a96 100644
--- a/cmdline/apt-sortpkgs.cc
+++ b/cmdline/apt-sortpkgs.cc
@@ -134,7 +134,7 @@ static bool DoIt(string InFile)
// ShowHelp - Show the help text /*{{{*/
// ---------------------------------------------------------------------
/* */
-static bool ShowHelp(CommandLine &)
+static bool ShowHelp(CommandLine &, CommandLine::DispatchWithHelp const *)
{
ioprintf(std::cout, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH);
if (_config->FindB("version") == true)
@@ -170,7 +170,7 @@ int main(int argc,const char *argv[]) /*{{{*/
textdomain(PACKAGE);
// Parse the command line and initialize the package library
- CommandLine::Dispatch Cmds[] = {{NULL, NULL}};
+ CommandLine::DispatchWithHelp Cmds[] = {{nullptr, nullptr, nullptr}};
CommandLine CmdL;
ParseCommandLine(CmdL, Cmds, Args, &_config, &_system, argc, argv, ShowHelp);
diff --git a/cmdline/apt.cc b/cmdline/apt.cc
index efc263a5d..53735356d 100644
--- a/cmdline/apt.cc
+++ b/cmdline/apt.cc
@@ -37,64 +37,53 @@
#include <apti18n.h>
/*}}}*/
-static bool ShowHelp(CommandLine &)
+static bool ShowHelp(CommandLine &, CommandLine::DispatchWithHelp const * Cmds)
{
ioprintf(c1out, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH);
// FIXME: generate from CommandLine
- c1out <<
+ c1out <<
_("Usage: apt [options] command\n"
"\n"
- "CLI for apt.\n"
- "Basic commands: \n"
- " list - list packages based on package names\n"
- " search - search in package descriptions\n"
- " show - show package details\n"
- "\n"
- " update - update list of available packages\n"
- "\n"
- " install - install packages\n"
- " remove - remove packages\n"
- " autoremove - Remove automatically all unused packages\n"
- "\n"
- " upgrade - upgrade the system by installing/upgrading packages\n"
- " full-upgrade - upgrade the system by removing/installing/upgrading packages\n"
- "\n"
- " edit-sources - edit the source information file\n"
- );
-
+ "CLI 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;
+ }
+
return true;
}
int main(int argc, const char *argv[]) /*{{{*/
{
- CommandLine::Dispatch Cmds[] = {
- // query
- {"list",&DoList},
- {"search", &DoSearch},
- {"show", &ShowPackage},
-
- // package stuff
- {"install",&DoInstall},
- {"remove", &DoInstall},
- {"autoremove", &DoInstall},
- {"auto-remove", &DoInstall},
- {"purge", &DoInstall},
-
- // system wide stuff
- {"update",&DoUpdate},
- {"upgrade",&DoUpgrade},
- {"full-upgrade",&DoDistUpgrade},
- // for compat with muscle memory
- {"dist-upgrade",&DoDistUpgrade},
-
- // misc
- {"edit-sources",&EditSources},
-
- // helper
- {"moo",&DoMoo},
- {"help",&ShowHelp},
- {0,0}};
+ CommandLine::DispatchWithHelp Cmds[] = {
+ // query
+ {"list", &DoList, _("list packages based on package names")},
+ {"search", &DoSearch, _("search in package descriptions")},
+ {"show", &ShowPackage, _("show package details")},
+
+ // package stuff
+ {"install", &DoInstall, _("install packages")},
+ {"remove", &DoInstall, _("remove packages")},
+ {"autoremove", &DoInstall, _("Remove automatically all unused packages")},
+ {"auto-remove", &DoInstall, nullptr},
+ {"purge", &DoInstall, nullptr},
+
+ // system wide stuff
+ {"update", &DoUpdate, _("update list of available packages")},
+ {"upgrade", &DoUpgrade, _("upgrade the system by installing/upgrading packages")},
+ {"full-upgrade", &DoDistUpgrade, _("upgrade the system by removing/installing/upgrading packages")},
+ {"dist-upgrade", &DoDistUpgrade, nullptr}, // for compat with muscle memory
+
+ // misc
+ {"edit-sources", &EditSources, _("edit the source information file")},
+ {"moo", &DoMoo, nullptr},
+ {nullptr, nullptr, nullptr}
+ };
std::vector<CommandLine::Args> Args = getCommandArgs("apt", CommandLine::GetCommand(Cmds, argc, argv));