+static void BinarySpecificConfiguration(char const * const Binary) /*{{{*/
+{
+ std::string const binary = flNotDir(Binary);
+ if (binary == "apt" || binary == "apt-config")
+ {
+ _config->CndSet("Binary::apt::APT::Color", true);
+ _config->CndSet("Binary::apt::APT::Cache::Show::Version", 2);
+ _config->CndSet("Binary::apt::APT::Cache::AllVersions", false);
+ _config->CndSet("Binary::apt::APT::Cache::ShowVirtuals", true);
+ _config->CndSet("Binary::apt::APT::Cache::Search::Version", 2);
+ _config->CndSet("Binary::apt::APT::Get::Upgrade-Allow-New", true);
+ _config->CndSet("Binary::apt::APT::Cmd::Show-Update-Stats", true);
+ _config->CndSet("Binary::apt::DPkg::Progress-Fancy", true);
+ }
+
+ _config->Set("Binary", binary);
+ std::string const conf = "Binary::" + binary;
+ _config->MoveSubTree(conf.c_str(), NULL);
+}
+ /*}}}*/
+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)
+ {
+ _error->DumpErrors();
+ exit(100);
+ }
+
+ if (likely(argc != 0 && argv[0] != NULL))
+ BinarySpecificConfiguration(argv[0]);
+
+ if (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);
+ }
+}
+ /*}}}*/