]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-internal-solver.cc
new quiet level -qq for apt to hide progress output
[apt.git] / cmdline / apt-internal-solver.cc
index 939061b9387f1d5220623fedc448c2b45ed6cd61..278f6d47176bb5856f35f58285705e5b05c6f108 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <apt-private/private-output.h>
 #include <apt-private/private-cmndline.h>
+#include <apt-private/private-main.h>
 
 #include <string.h>
 #include <iostream>
@@ -43,7 +44,7 @@
 // ShowHelp - Show a help screen                                       /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-static bool ShowHelp(CommandLine &) {
+static bool ShowHelp(CommandLine &, CommandLine::DispatchWithHelp const *) {
        ioprintf(std::cout, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH);
 
        std::cout <<
@@ -68,20 +69,13 @@ APT_NORETURN static void DIE(std::string const &message) {          /*{{{*/
                                                                        /*}}}*/
 int main(int argc,const char *argv[])                                  /*{{{*/
 {
-       CommandLine::Args Args[] = {
-               {'h',"help","help",0},
-               {'v',"version","version",0},
-               {'q',"quiet","quiet",CommandLine::IntLevel},
-               {'q',"silent","quiet",CommandLine::IntLevel},
-               {'c',"config-file",0,CommandLine::ConfigFile},
-               {'o',"option",0,CommandLine::ArbItem},
-               {0,0,0,0}};
-
-        // we really don't need anything
-        DropPrivileges();
+       InitLocale();
+
+       // we really don't need anything
+       DropPrivileges();
 
        CommandLine CmdL;
-       ParseCommandLine(CmdL, NULL, Args, &_config, NULL, argc, argv, ShowHelp);
+       ParseCommandLine(CmdL, nullptr, "apt-internal-solver", &_config, NULL, argc, argv, ShowHelp);
 
        if (CmdL.FileList[0] != 0 && strcmp(CmdL.FileList[0], "scenario") == 0)
        {
@@ -109,8 +103,9 @@ int main(int argc,const char *argv[])                                       /*{{{*/
        if (_config->FindI("quiet", 0) < 1)
                _config->Set("Debug::EDSP::WriteSolution", true);
 
+       _config->Set("APT::System", "Debian APT solver interface");
        _config->Set("APT::Solver", "internal");
-       _config->Set("edsp::scenario", "stdin");
+       _config->Set("edsp::scenario", "/nonexistent/stdin");
        int input = STDIN_FILENO;
        FILE* output = stdout;
        SetNonBlock(input, false);
@@ -187,11 +182,6 @@ int main(int argc,const char *argv[])                                      /*{{{*/
 
        EDSP::WriteProgress(100, "Done", output);
 
-       bool const Errors = _error->PendingError();
-       if (_config->FindI("quiet",0) > 0)
-               _error->DumpErrors(std::cerr);
-       else
-               _error->DumpErrors(std::cerr, GlobalError::DEBUG);
-       return Errors == true ? 100 : 0;
+       return DispatchCommandLine(CmdL, nullptr);
 }
                                                                        /*}}}*/