summaryrefslogtreecommitdiff
path: root/apt-private/private-cmndline.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-private/private-cmndline.cc')
-rw-r--r--apt-private/private-cmndline.cc34
1 files changed, 34 insertions, 0 deletions
diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc
index c0f631a08..41aab81f6 100644
--- a/apt-private/private-cmndline.cc
+++ b/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>
/*}}}*/
@@ -198,6 +203,7 @@ static bool addArgumentsAPTGet(std::vector<CommandLine::Args> &Args, char const
addArg(0,"only-source","APT::Get::Only-Source",0);
addArg(0,"arch-only","APT::Get::Arch-Only",0);
addArg(0,"allow-unauthenticated","APT::Get::AllowUnauthenticated",0);
+ addArg(0,"allow-insecure-repositories","Acquire::AllowInsecureRepositories",0);
addArg(0,"install-recommends","APT::Install-Recommends",CommandLine::Boolean);
addArg(0,"install-suggests","APT::Install-Suggests",CommandLine::Boolean);
addArg(0,"fix-policy","APT::Get::Fix-Policy-Broken",0);
@@ -286,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);
+ }
+}
+ /*}}}*/