Browse Source

streamline display of --help in all tools

By convention, if I run a tool with --help or --version I expect it to
exit successfully with the usage, while if I do call it wrong (like
without any parameters) I expect the usage message shown with a non-zero
exit.
David Kalnischkies 9 years ago
parent
commit
ad7e0941b3

+ 3 - 0
apt-pkg/contrib/cmndline.cc

@@ -33,6 +33,9 @@ using namespace std;
 CommandLine::CommandLine(Args *AList,Configuration *Conf) : ArgList(AList), 
                                  Conf(Conf), FileList(0)
 {
+}
+CommandLine::CommandLine() : ArgList(NULL), Conf(NULL), FileList(0)
+{
 }
 									/*}}}*/
 // CommandLine::~CommandLine - Destructor				/*{{{*/

+ 1 - 0
apt-pkg/contrib/cmndline.h

@@ -91,6 +91,7 @@ class CommandLine
    static CommandLine::Args MakeArgs(char ShortOpt, char const *LongOpt,
 	 char const *ConfName, unsigned long Flags) APT_CONST;
 
+   CommandLine();
    CommandLine(Args *AList,Configuration *Conf);
    ~CommandLine();
 };

+ 33 - 0
apt-private/private-cmndline.cc

@@ -2,12 +2,17 @@
 #include <config.h>
 
 #include <apt-pkg/cmndline.h>
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/pkgsystem.h>
+#include <apt-pkg/init.h>
+#include <apt-pkg/error.h>
 
 #include <apt-private/private-cmndline.h>
 
 #include <vector>
 #include <stdarg.h>
 #include <string.h>
+#include <stdlib.h>
 
 #include <apti18n.h>
 									/*}}}*/
@@ -287,3 +292,31 @@ std::vector<CommandLine::Args> getCommandArgs(char const * const Program, char c
 									/*}}}*/
 #undef CmdMatches
 #undef addArg
+void ParseCommandLine(CommandLine &CmdL, CommandLine::Dispatch * const Cmds, CommandLine::Args * const Args,/*{{{*/
+      Configuration * const * const Cnf, pkgSystem ** const Sys, int const argc, const char *argv[], bool(*ShowHelp)(CommandLine &CmdL))
+{
+   CmdL = CommandLine(Args,_config);
+   if ((Cnf != NULL && pkgInitConfig(**Cnf) == false) ||
+       CmdL.Parse(argc,argv) == false ||
+       (Sys != NULL && pkgInitSystem(*_config, *Sys) == false))
+   {
+      if (_config->FindB("version") == true)
+	 ShowHelp(CmdL);
+
+      _error->DumpErrors();
+      exit(100);
+   }
+
+   // See if the help should be shown
+   if (_config->FindB("help") == true || _config->FindB("version") == true)
+   {
+      ShowHelp(CmdL);
+      exit(0);
+   }
+   if (Cmds != NULL && CmdL.FileSize() == 0)
+   {
+      ShowHelp(CmdL);
+      exit(1);
+   }
+}
+									/*}}}*/

+ 6 - 0
apt-private/private-cmndline.h

@@ -6,6 +6,12 @@
 
 #include <vector>
 
+class Configuration;
+class pkgSystem;
+
 APT_PUBLIC std::vector<CommandLine::Args> getCommandArgs(char const * const Program, char const * const Cmd);
+APT_PUBLIC void ParseCommandLine(CommandLine &CmdL, CommandLine::Dispatch * const Cmds, CommandLine::Args * const Args,
+      Configuration * const * const Cnf, pkgSystem ** const Sys, int const argc, const char * argv[],
+      bool(*ShowHelp)(CommandLine &CmdL));
 
 #endif

+ 2 - 16
cmdline/apt-cache.cc

@@ -1896,23 +1896,9 @@ int main(int argc,const char *argv[])					/*{{{*/
    textdomain(PACKAGE);
 
    // Parse the command line and initialize the package library
-   CommandLine CmdL(Args.data(),_config);
-   if (pkgInitConfig(*_config) == false ||
-       CmdL.Parse(argc,argv) == false ||
-       pkgInitSystem(*_config,_system) == false)
-   {
-      _error->DumpErrors();
-      return 100;
-   }
+   CommandLine CmdL;
+   ParseCommandLine(CmdL, Cmds, Args.data(), &_config, &_system, argc, argv, ShowHelp);
 
-   // See if the help should be shown
-   if (_config->FindB("help") == true ||
-       CmdL.FileSize() == 0)
-   {
-      ShowHelp(CmdL);
-      return 0;
-   }
-   
    // Deal with stdout not being a tty
    if (!isatty(STDOUT_FILENO) && _config->FindI("quiet", -1) == -1)
       _config->Set("quiet","1");

+ 2 - 13
cmdline/apt-cdrom.cc

@@ -249,19 +249,8 @@ int main(int argc,const char *argv[])					/*{{{*/
    textdomain(PACKAGE);
 
    // Parse the command line and initialize the package library
-   CommandLine CmdL(Args.data(),_config);
-   if (pkgInitConfig(*_config) == false ||
-       CmdL.Parse(argc,argv) == false ||
-       pkgInitSystem(*_config,_system) == false)
-   {
-      _error->DumpErrors();
-      return 100;
-   }
-
-   // See if the help should be shown
-   if (_config->FindB("help") == true || _config->FindB("version") == true ||
-       CmdL.FileSize() == 0)
-      return ShowHelp(CmdL);
+   CommandLine CmdL;
+   ParseCommandLine(CmdL, Cmds, Args.data(), &_config, &_system, argc, argv, ShowHelp);
 
    // Deal with stdout not being a tty
    if (isatty(STDOUT_FILENO) && _config->FindI("quiet", -1) == -1)

+ 2 - 13
cmdline/apt-config.cc

@@ -115,19 +115,8 @@ int main(int argc,const char *argv[])					/*{{{*/
    textdomain(PACKAGE);
 
    // Parse the command line and initialize the package library
-   CommandLine CmdL(Args.data(),_config);
-   if (pkgInitConfig(*_config) == false ||
-       CmdL.Parse(argc,argv) == false ||
-       pkgInitSystem(*_config,_system) == false)
-   {
-      _error->DumpErrors();
-      return 100;
-   }
-
-   // See if the help should be shown
-   if (_config->FindB("help") == true ||
-       CmdL.FileSize() == 0)
-      return ShowHelp(CmdL);
+   CommandLine CmdL;
+   ParseCommandLine(CmdL, Cmds, Args.data(), &_config, &_system, argc, argv, ShowHelp);
 
    std::vector<std::string> const langs = APT::Configuration::getLanguages(true);
    _config->Clear("Acquire::Languages");

+ 12 - 20
cmdline/apt-extracttemplates.cc

@@ -33,6 +33,8 @@
 #include <apt-pkg/dirstream.h>
 #include <apt-pkg/mmap.h>
 
+#include <apt-private/private-cmndline.h>
+
 #include <iostream>
 #include <stdio.h>
 #include <string.h>
@@ -215,15 +217,15 @@ bool DebFile::ParseInfo()
 // ShowHelp - show a short help text					/*{{{*/
 // ---------------------------------------------------------------------
 /* */
-static int ShowHelp(void)
+static bool ShowHelp(CommandLine &)
 {
-   	ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION,
+	ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION,
 	    COMMON_ARCH,__DATE__,__TIME__);
 
-	if (_config->FindB("version") == true) 
-		return 0;
+	if (_config->FindB("version") == true)
+		return true;
 
-	cout << 
+	cout <<
 		_("Usage: apt-extracttemplates file1 [file2 ...]\n"
 		"\n"
 		"apt-extracttemplates is a tool to extract config and template info\n"
@@ -234,7 +236,7 @@ static int ShowHelp(void)
 		"  -t   Set the temp dir\n"
 		"  -c=? Read this configuration file\n"
 		"  -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp\n");
-	return 0;
+	return true;
 }
 									/*}}}*/
 // WriteFile - write the contents of the passed string to a file	/*{{{*/
@@ -356,20 +358,10 @@ int main(int argc, const char **argv)					/*{{{*/
 	textdomain(PACKAGE);
 
 	// Parse the command line and initialize the package library
-	CommandLine CmdL(Args,_config);
-	if (pkgInitConfig(*_config) == false ||
-	    CmdL.Parse(argc,argv) == false ||
-	    pkgInitSystem(*_config,_system) == false)
-	{
-		_error->DumpErrors();
-		return 100;
-	}
-	
-	// See if the help should be shown
-	if (_config->FindB("help") == true ||
-	    CmdL.FileSize() == 0)
-		return ShowHelp();
-	
+	CommandLine::Dispatch Cmds[] = {{NULL, NULL}};
+	CommandLine CmdL;
+	ParseCommandLine(CmdL, Cmds, Args, &_config, &_system, argc, argv, ShowHelp);
+
 	Go(CmdL);
 
 	// Print any errors or warnings found during operation

+ 2 - 20
cmdline/apt-get.cc

@@ -1746,26 +1746,8 @@ int main(int argc,const char *argv[])					/*{{{*/
    textdomain(PACKAGE);
 
    // Parse the command line and initialize the package library
-   CommandLine CmdL(Args.data(),_config);
-   if (pkgInitConfig(*_config) == false ||
-       CmdL.Parse(argc,argv) == false ||
-       pkgInitSystem(*_config,_system) == false)
-   {
-      if (_config->FindB("version") == true)
-	 ShowHelp(CmdL);
-	 
-      _error->DumpErrors();
-      return 100;
-   }
-
-   // See if the help should be shown
-   if (_config->FindB("help") == true ||
-       _config->FindB("version") == true ||
-       CmdL.FileSize() == 0)
-   {
-      ShowHelp(CmdL);
-      return 0;
-   }
+   CommandLine CmdL;
+   ParseCommandLine(CmdL, Cmds, Args.data(), &_config, &_system, argc, argv, ShowHelp);
 
    // see if we are in simulate mode
    CheckSimulateMode(CmdL);

+ 2 - 19
cmdline/apt-helper.cc

@@ -108,25 +108,8 @@ int main(int argc,const char *argv[])					/*{{{*/
    textdomain(PACKAGE);
 
    // Parse the command line and initialize the package library
-   CommandLine CmdL(Args.data(),_config);
-   if (pkgInitConfig(*_config) == false ||
-       CmdL.Parse(argc,argv) == false ||
-       pkgInitSystem(*_config,_system) == false)
-   {
-      if (_config->FindB("version") == true)
-	 ShowHelp(CmdL);
-      _error->DumpErrors();
-      return 100;
-   }
-
-   // See if the help should be shown
-   if (_config->FindB("help") == true ||
-       _config->FindB("version") == true ||
-       CmdL.FileSize() == 0)
-   {
-      ShowHelp(CmdL);
-      return 0;
-   }
+   CommandLine CmdL;
+   ParseCommandLine(CmdL, Cmds, Args.data(), &_config, &_system, argc, argv, ShowHelp);
 
    InitOutput();
 

+ 4 - 13
cmdline/apt-internal-solver.cc

@@ -24,7 +24,9 @@
 #include <apt-pkg/depcache.h>
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/cacheiterators.h>
+
 #include <apt-private/private-output.h>
+#include <apt-private/private-cmndline.h>
 
 #include <string.h>
 #include <iostream>
@@ -79,19 +81,8 @@ int main(int argc,const char *argv[])					/*{{{*/
         // we really don't need anything
         DropPrivileges();
 
-	CommandLine CmdL(Args,_config);
-	if (pkgInitConfig(*_config) == false ||
-	    CmdL.Parse(argc,argv) == false) {
-		_error->DumpErrors();
-		return 2;
-	}
-
-	// See if the help should be shown
-	if (_config->FindB("help") == true ||
-	    _config->FindB("version") == true) {
-		ShowHelp(CmdL);
-		return 1;
-	}
+	CommandLine CmdL;
+	ParseCommandLine(CmdL, NULL, Args, &_config, NULL, argc, argv, ShowHelp);
 
 	if (CmdL.FileList[0] != 0 && strcmp(CmdL.FileList[0], "scenario") == 0)
 	{

+ 2 - 20
cmdline/apt-mark.cc

@@ -441,26 +441,8 @@ int main(int argc,const char *argv[])					/*{{{*/
    setlocale(LC_ALL,"");
    textdomain(PACKAGE);
 
-   // Parse the command line and initialize the package library
-   CommandLine CmdL(Args.data(),_config);
-   if (pkgInitConfig(*_config) == false ||
-       CmdL.Parse(argc,argv) == false ||
-       pkgInitSystem(*_config,_system) == false)
-   {
-      if (_config->FindB("version") == true)
-	 ShowHelp(CmdL);
-      _error->DumpErrors();
-      return 100;
-   }
-
-   // See if the help should be shown
-   if (_config->FindB("help") == true ||
-       _config->FindB("version") == true ||
-       CmdL.FileSize() == 0)
-   {
-      ShowHelp(CmdL);
-      return 0;
-   }
+   CommandLine CmdL;
+   ParseCommandLine(CmdL, Cmds, Args.data(), &_config, &_system, argc, argv, ShowHelp);
 
    // Deal with stdout not being a tty
    if (!isatty(STDOUT_FILENO) && _config->FindI("quiet", -1) == -1)

+ 8 - 16
cmdline/apt-sortpkgs.cc

@@ -23,6 +23,8 @@
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/pkgsystem.h>
 
+#include <apt-private/private-cmndline.h>
+
 #include <vector>
 #include <algorithm>
 #include <stdio.h>
@@ -142,12 +144,12 @@ static bool DoIt(string InFile)
 // ShowHelp - Show the help text					/*{{{*/
 // ---------------------------------------------------------------------
 /* */
-static int ShowHelp()
+static bool ShowHelp(CommandLine &)
 {
    ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION,
 	    COMMON_ARCH,__DATE__,__TIME__);
    if (_config->FindB("version") == true)
-      return 0;
+      return true;
    
    cout <<
     _("Usage: apt-sortpkgs [options] file1 [file2 ...]\n"
@@ -161,7 +163,7 @@ static int ShowHelp()
       "  -c=? Read this configuration file\n"
       "  -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp\n");
 
-   return 0;
+   return true;
 }
 									/*}}}*/
 int main(int argc,const char *argv[])					/*{{{*/
@@ -179,19 +181,9 @@ int main(int argc,const char *argv[])					/*{{{*/
    textdomain(PACKAGE);
 
    // Parse the command line and initialize the package library
-   CommandLine CmdL(Args,_config);
-   if (pkgInitConfig(*_config) == false ||
-       CmdL.Parse(argc,argv) == false ||
-       pkgInitSystem(*_config,_system) == false)
-   {
-      _error->DumpErrors();
-      return 100;
-   }
-
-   // See if the help should be shown
-   if (_config->FindB("help") == true ||
-       CmdL.FileSize() == 0)
-      return ShowHelp();
+   CommandLine::Dispatch Cmds[] = {{NULL, NULL}};
+   CommandLine CmdL;
+   ParseCommandLine(CmdL, Cmds, Args, &_config, &_system, argc, argv, ShowHelp);
 
    // Match the operation
    for (unsigned int I = 0; I != CmdL.FileSize(); I++)

+ 3 - 17
cmdline/apt.cc

@@ -119,15 +119,10 @@ int main(int argc, const char *argv[])					/*{{{*/
    _config->CndSet("APT::Cmd::Show-Update-Stats", true);
 
    // Parse the command line and initialize the package library
-   CommandLine CmdL(Args.data(), _config);
-   if (CmdL.Parse(argc, argv) == false ||
-       pkgInitSystem(*_config, _system) == false)
-   {
-      _error->DumpErrors();
-      return 100;
-   }
+   CommandLine CmdL;
+   ParseCommandLine(CmdL, Cmds, Args.data(), NULL, &_system, argc, argv, ShowHelp);
 
-   if(!isatty(STDOUT_FILENO) && 
+   if(!isatty(STDOUT_FILENO) &&
       _config->FindB("Apt::Cmd::Disable-Script-Warning", false) == false)
    {
       std::cerr << std::endl
@@ -138,15 +133,6 @@ int main(int argc, const char *argv[])					/*{{{*/
                 << std::endl;
    }
 
-   // See if the help should be shown
-   if (_config->FindB("help") == true ||
-       _config->FindB("version") == true ||
-       CmdL.FileSize() == 0)
-   {
-      ShowHelp(CmdL);
-      return 0;
-   }
-
    // see if we are in simulate mode
    CheckSimulateMode(CmdL);
 

+ 4 - 4
cmdline/makefile

@@ -67,15 +67,15 @@ APT_DOMAIN:=apt-utils
 
 # The apt-sortpkgs program
 PROGRAM=apt-sortpkgs
-SLIBS = -lapt-pkg $(INTLLIBS)
-LIB_MAKES = apt-pkg/makefile
+SLIBS = -lapt-pkg -lapt-private $(INTLLIBS)
+LIB_MAKES = apt-pkg/makefile apt-private/makefile
 SOURCE = apt-sortpkgs.cc
 include $(PROGRAM_H)
 
 # The apt-extracttemplates program
 PROGRAM=apt-extracttemplates
-SLIBS = -lapt-pkg -lapt-inst $(INTLLIBS)
-LIB_MAKES = apt-pkg/makefile apt-inst/makefile
+SLIBS = -lapt-pkg -lapt-inst -lapt-private $(INTLLIBS)
+LIB_MAKES = apt-pkg/makefile apt-inst/makefile apt-private/makefile
 SOURCE = apt-extracttemplates.cc 
 include $(PROGRAM_H)
 

+ 1 - 0
debian/tests/run-tests

@@ -15,6 +15,7 @@ APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR=$(pwd)/build/bin \
 APT_INTEGRATION_TESTS_METHODS_DIR=/usr/lib/apt/methods \
 APT_INTEGRATION_TESTS_LIBEXEC_DIR=/usr/lib/apt/ \
 APT_INTEGRATION_TESTS_INTERNAL_SOLVER=/usr/lib/apt/solvers/apt \
+APT_INTEGRATION_TESTS_DUMP_SOLVER=/usr/lib/apt/solvers/dump \
 APT_INTEGRATION_TESTS_BUILD_DIR=/usr/bin \
 APT_INTEGRATION_TESTS_LIBRARY_PATH=/dev/null/does/not/exist \
 ./test/integration/run-tests

+ 4 - 15
ftparchive/apt-ftparchive.cc

@@ -19,6 +19,8 @@
 #include <apt-pkg/init.h>
 #include <apt-pkg/fileutl.h>
 
+#include <apt-private/private-cmndline.h>
+
 #include <algorithm>
 #include <climits>
 #include <sys/time.h>
@@ -1060,21 +1062,8 @@ int main(int argc, const char *argv[])
 
    // Parse the command line and initialize the package library
    CommandLine CmdL(Args,_config);
-   if (pkgInitConfig(*_config) == false || CmdL.Parse(argc,argv) == false)
-   {
-      _error->DumpErrors();
-      return 100;
-   }
-   
-   // See if the help should be shown
-   if (_config->FindB("help") == true ||
-       _config->FindB("version") == true ||
-       CmdL.FileSize() == 0)
-   {
-      ShowHelp(CmdL);
-      return 0;
-   }
-   
+   ParseCommandLine(CmdL, Cmds, Args, &_config, NULL, argc, argv, ShowHelp);
+
    // Setup the output streams
    c0out.rdbuf(clog.rdbuf());
    c1out.rdbuf(clog.rdbuf());

+ 2 - 2
ftparchive/makefile

@@ -9,8 +9,8 @@ include ../buildlib/defaults.mak
 ifdef BDBLIB
 APT_DOMAIN:=apt-utils
 PROGRAM=apt-ftparchive
-SLIBS = -lapt-pkg -lapt-inst $(BDBLIB) $(INTLLIBS)
-LIB_MAKES = apt-pkg/makefile apt-inst/makefile
+SLIBS = -lapt-pkg -lapt-inst -lapt-private $(BDBLIB) $(INTLLIBS)
+LIB_MAKES = apt-pkg/makefile apt-inst/makefile apt-private/makefile
 SOURCE = apt-ftparchive.cc cachedb.cc writer.cc contents.cc override.cc \
          multicompress.cc sources.cc
 include $(PROGRAM_H)

+ 2 - 2
prepare-release

@@ -130,8 +130,8 @@ elif [ "$1" = 'coverage' ]; then
 	LCOVRC='--rc geninfo_checksum=1 --rc lcov_branch_coverage=1'
 	mkdir "$DIR"
 	lcov --no-external --directory . --capture --initial --output-file "${DIR}/apt.coverage.init" ${LCOVRC}
-	make test
-	./test/integration/run-tests -q
+	make test || true
+	./test/integration/run-tests -q || true
 	lcov --no-external --directory . --capture --output-file "${DIR}/apt.coverage.run" ${LCOVRC}
 	lcov -a "${DIR}/apt.coverage.init" -a "${DIR}/apt.coverage.run"  -o "${DIR}/apt.coverage.total" ${LCOVRC}
 	cp "${DIR}/apt.coverage.total" "${DIR}/apt.coverage.fixed"

+ 2 - 0
test/integration/framework

@@ -128,6 +128,7 @@ aptwebserver() { runapt "${APTWEBSERVERBINDIR}/aptwebserver" "$@"; }
 aptitude() { runapt aptitude "$@"; }
 aptextracttemplates() { runapt apt-extracttemplates "$@"; }
 aptinternalsolver() { runapt "${APTINTERNALSOLVER}" "$@"; }
+aptdumpsolver() { runapt "${APTDUMPSOLVER}" "$@"; }
 
 dpkg() {
 	command dpkg --root=${TMPWORKINGDIRECTORY}/rootdir --force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log "$@"
@@ -194,6 +195,7 @@ setupenvironment() {
         APTHELPERBINDIR=${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"}
         APTWEBSERVERBINDIR=${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}"}
         APTINTERNALSOLVER=${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${BUILDDIRECTORY}/apt-internal-solver"}
+	APTDUMPSOLVER=${APT_INTEGRATION_TESTS_DUMP_SOLVER:-"${BUILDDIRECTORY}/apt-dump-solver"}
 	test -x "${BUILDDIRECTORY}/apt-get" || msgdie "You need to build tree first"
         # -----
 

+ 52 - 0
test/integration/test-00-commands-have-help

@@ -0,0 +1,52 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'amd64'
+
+# this test does double duty: The obvious is checking for --help and co,
+# but it also checks if the binary can find all methods in the library.
+# The later is quite handy for manual testing of non-abibreaking changes
+export LD_BIND_NOW=1
+
+checkversionmessage() {
+	testsuccess grep '^apt .* compiled on ' ${1}-help.output
+}
+
+checkhelpmessage() {
+	checkversionmessage "$1"
+	testsuccess grep '^Usage:' ${1}-help.output
+}
+
+checkoptions() {
+	testsuccess $1 --help
+	cp -f rootdir/tmp/testsuccess.output ${1}-help.output
+	checkhelpmessage "$1"
+
+	testsuccess $1 --version
+	cp -f rootdir/tmp/testsuccess.output ${1}-help.output
+	checkversionmessage "$1"
+}
+
+for CMD in 'apt-cache' 'apt-cdrom' 'apt-config' \
+	'apt-extracttemplates' 'apt-get' 'apt-helper' \
+	'apt-mark' 'apt-sortpkgs' 'apt' 'apt-ftparchive'; do
+	cmd="$(echo "$CMD" | tr -d '-')"
+	msgtest 'Test for failure with no parameters calling' "$CMD"
+	if $cmd > ${cmd}-help.output 2>&1; then
+		echo
+		cat ${cmd}-help.output
+		msgfail 'zero exit'
+	else
+		msgpass
+	fi
+	checkhelpmessage "$cmd"
+	checkoptions "$cmd"
+done
+
+for CMD in 'apt-dump-solver'  'apt-internal-solver'; do
+	checkoptions "$(echo "$CMD" | tr -d '-')"
+done