diff options
author | David Kalnischkies <david@kalnischkies.de> | 2014-11-08 18:14:46 +0100 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2014-11-09 01:26:07 +0100 |
commit | ad7e0941b376d792911f240377094a2e78ca8756 (patch) | |
tree | a7e65478aa213bd7639cd45e8025989b6d413bfa /cmdline/apt-internal-solver.cc | |
parent | 20801f613690b330c79b4f7a30dc3ff52b722468 (diff) |
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.
Diffstat (limited to 'cmdline/apt-internal-solver.cc')
-rw-r--r-- | cmdline/apt-internal-solver.cc | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/cmdline/apt-internal-solver.cc b/cmdline/apt-internal-solver.cc index 92a4429e5..4fabeb02f 100644 --- a/cmdline/apt-internal-solver.cc +++ b/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) { |