summaryrefslogtreecommitdiff
path: root/ftparchive/apt-ftparchive.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-11-08 18:14:46 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2014-11-09 01:26:07 +0100
commitad7e0941b376d792911f240377094a2e78ca8756 (patch)
treea7e65478aa213bd7639cd45e8025989b6d413bfa /ftparchive/apt-ftparchive.cc
parent20801f613690b330c79b4f7a30dc3ff52b722468 (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 'ftparchive/apt-ftparchive.cc')
-rw-r--r--ftparchive/apt-ftparchive.cc19
1 files changed, 4 insertions, 15 deletions
diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc
index ebf99a8f8..7d9af4178 100644
--- a/ftparchive/apt-ftparchive.cc
+++ b/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());