From 41d39345bdc31cb9b8be057cd678aa2890830437 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 26 Oct 2015 16:50:21 +0100 Subject: deal with --version more centrally Git-Dch: Ignore --- cmdline/apt-cache.cc | 16 ++-------------- cmdline/apt-cdrom.cc | 16 ++-------------- cmdline/apt-config.cc | 15 ++------------- cmdline/apt-extracttemplates.cc | 5 ----- cmdline/apt-get.cc | 13 ++----------- cmdline/apt-helper.cc | 17 ++--------------- cmdline/apt-internal-solver.cc | 2 -- cmdline/apt-mark.cc | 14 ++------------ cmdline/apt-sortpkgs.cc | 7 +------ cmdline/apt.cc | 14 ++------------ 10 files changed, 15 insertions(+), 104 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index 50af3f329..4e8a51583 100644 --- a/cmdline/apt-cache.cc +++ b/cmdline/apt-cache.cc @@ -1524,26 +1524,14 @@ static bool GenCaches(CommandLine &) /*}}}*/ bool ShowHelp(CommandLine &, aptDispatchWithHelp const * Cmds) /*{{{*/ { - ioprintf(cout, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH); - - if (_config->FindB("version") == true) - return true; - std::cout << _("Usage: apt-cache [options] command\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") - << std::endl - << _("Commands:") << std::endl; - for (; Cmds->Handler != nullptr; ++Cmds) - { - if (Cmds->Help == nullptr) - continue; - std::cout << " " << Cmds->Match << " - " << Cmds->Help << std::endl; - } - + << std::endl; + ShowHelpListCommands(Cmds); std::cout << std::endl << _("Options:\n" " -h This help text.\n" diff --git a/cmdline/apt-cdrom.cc b/cmdline/apt-cdrom.cc index 699cc550c..00895863b 100644 --- a/cmdline/apt-cdrom.cc +++ b/cmdline/apt-cdrom.cc @@ -205,26 +205,14 @@ static bool DoIdent(CommandLine &) /*}}}*/ bool ShowHelp(CommandLine &, aptDispatchWithHelp const * Cmds) /*{{{*/ { - ioprintf(cout, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH); - - if (_config->FindB("version") == true) - return true; - 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" "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::endl; + ShowHelpListCommands(Cmds); std::cout << std::endl << _("Options:\n" " -h This help text\n" diff --git a/cmdline/apt-config.cc b/cmdline/apt-config.cc index 47e37c2f7..eb096440a 100644 --- a/cmdline/apt-config.cc +++ b/cmdline/apt-config.cc @@ -78,23 +78,12 @@ static bool DoDump(CommandLine &CmdL) /*}}}*/ bool ShowHelp(CommandLine &, aptDispatchWithHelp const * Cmds) /*{{{*/ { - ioprintf(cout, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH); - if (_config->FindB("version") == true) - return true; - std::cout << _("Usage: apt-config [options] command\n" "\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::endl; + ShowHelpListCommands(Cmds); std::cout << std::endl << _("Options:\n" " -h This help text.\n" diff --git a/cmdline/apt-extracttemplates.cc b/cmdline/apt-extracttemplates.cc index 1b16542fe..b63f2ff16 100644 --- a/cmdline/apt-extracttemplates.cc +++ b/cmdline/apt-extracttemplates.cc @@ -217,11 +217,6 @@ bool DebFile::ParseInfo() /*}}}*/ bool ShowHelp(CommandLine &, aptDispatchWithHelp const *) /*{{{*/ { - ioprintf(std::cout, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH); - - if (_config->FindB("version") == true) - return true; - cout << _("Usage: apt-extracttemplates file1 [file2 ...]\n" "\n" diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 69b12b2c7..474ed3159 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1528,8 +1528,6 @@ static bool DoIndexTargets(CommandLine &CmdL) /*}}}*/ bool ShowHelp(CommandLine &, aptDispatchWithHelp const * Cmds) /*{{{*/ { - ioprintf(cout, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH); - if (_config->FindB("version") == true) { cout << _("Supported modules:") << endl; @@ -1580,15 +1578,8 @@ bool ShowHelp(CommandLine &, aptDispatchWithHelp const * Cmds) /*{{{*/ "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") - << std::endl - << _("Commands:") << std::endl; - for (; Cmds->Handler != nullptr; ++Cmds) - { - if (Cmds->Help == nullptr) - continue; - std::cout << " " << Cmds->Match << " - " << Cmds->Help << std::endl; - } - + << std::endl; + ShowHelpListCommands(Cmds); std::cout << std::endl << _("Options:\n" " -h This help text.\n" diff --git a/cmdline/apt-helper.cc b/cmdline/apt-helper.cc index b0c1ddacf..be6c2881a 100644 --- a/cmdline/apt-helper.cc +++ b/cmdline/apt-helper.cc @@ -107,26 +107,13 @@ static bool DoSrvLookup(CommandLine &CmdL) /*{{{*/ /*}}}*/ bool ShowHelp(CommandLine &, aptDispatchWithHelp const * Cmds) /*{{{*/ { - ioprintf(std::cout, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH); - - if (_config->FindB("version") == true) - return true; - std::cout << _("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") - << std::endl - << _("Commands:") << std::endl; - - for (; Cmds->Handler != nullptr; ++Cmds) - { - if (Cmds->Help == nullptr) - continue; - std::cout << " " << Cmds->Match << " - " << Cmds->Help << std::endl; - } - + << std::endl; + ShowHelpListCommands(Cmds); std::cout << std::endl << _("This APT helper has Super Meep Powers.") << std::endl; return true; diff --git a/cmdline/apt-internal-solver.cc b/cmdline/apt-internal-solver.cc index 28989f6cd..ae8c08bba 100644 --- a/cmdline/apt-internal-solver.cc +++ b/cmdline/apt-internal-solver.cc @@ -43,8 +43,6 @@ bool ShowHelp(CommandLine &, aptDispatchWithHelp const *) /*{{{*/ { - ioprintf(std::cout, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH); - std::cout << _("Usage: apt-internal-solver\n" "\n" diff --git a/cmdline/apt-mark.cc b/cmdline/apt-mark.cc index d02e80beb..b06fcc0cc 100644 --- a/cmdline/apt-mark.cc +++ b/cmdline/apt-mark.cc @@ -282,23 +282,13 @@ static bool ShowSelection(CommandLine &CmdL) /*{{{*/ /*}}}*/ bool ShowHelp(CommandLine &, aptDispatchWithHelp const * Cmds) /*{{{*/ { - ioprintf(std::cout, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH); - 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") - << std::endl - << _("Commands:") << std::endl; - - for (; Cmds->Handler != nullptr; ++Cmds) - { - if (Cmds->Help == nullptr) - continue; - std::cout << " " << Cmds->Match << " - " << Cmds->Help << std::endl; - } - + << std::endl; + ShowHelpListCommands(Cmds); std::cout << std::endl << _("Options:\n" " -h This help text.\n" diff --git a/cmdline/apt-sortpkgs.cc b/cmdline/apt-sortpkgs.cc index b5a2c12df..f9aa7d728 100644 --- a/cmdline/apt-sortpkgs.cc +++ b/cmdline/apt-sortpkgs.cc @@ -134,11 +134,7 @@ static bool DoIt(string InFile) /*}}}*/ bool ShowHelp(CommandLine &, aptDispatchWithHelp const *) /*{{{*/ { - ioprintf(std::cout, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH); - if (_config->FindB("version") == true) - return true; - - cout << + std::cout << _("Usage: apt-sortpkgs [options] file1 [file2 ...]\n" "\n" "apt-sortpkgs is a simple tool to sort package files. The -s option is used\n" @@ -149,7 +145,6 @@ bool ShowHelp(CommandLine &, aptDispatchWithHelp const *) /*{{{*/ " -s Use source file sorting\n" " -c=? Read this configuration file\n" " -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp\n"); - return true; } /*}}}*/ diff --git a/cmdline/apt.cc b/cmdline/apt.cc index be2f7663e..3eae22199 100644 --- a/cmdline/apt.cc +++ b/cmdline/apt.cc @@ -39,22 +39,12 @@ bool ShowHelp(CommandLine &, aptDispatchWithHelp const * Cmds) /*{{{*/ { - ioprintf(std::cout, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH); - - // FIXME: generate from CommandLine std::cout << _("Usage: apt [options] command\n" "\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; - } - + << std::endl; + ShowHelpListCommands(Cmds); return true; } /*}}}*/ -- cgit v1.2.3