X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/796673c38509300c988fbba2f2679ba3c76916db..5ad0096a4e19e191b59634e8a8817995ec4045ad:/cmdline/apt.cc diff --git a/cmdline/apt.cc b/cmdline/apt.cc index 6fe25e3f3..2f7eddb61 100644 --- a/cmdline/apt.cc +++ b/cmdline/apt.cc @@ -11,39 +11,12 @@ // Include Files /*{{{*/ #include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - +#include #include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include - -#include +#include +#include #include #include @@ -55,16 +28,18 @@ #include #include #include -#include #include - /*}}}*/ +#include +#include +#include +#include + /*}}}*/ -bool ShowHelp(CommandLine &CmdL) +static bool ShowHelp(CommandLine &) { - ioprintf(c1out,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, - COMMON_ARCH,__DATE__,__TIME__); + ioprintf(c1out, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH); // FIXME: generate from CommandLine c1out << @@ -82,7 +57,7 @@ bool ShowHelp(CommandLine &CmdL) " remove - remove packages\n" "\n" " upgrade - upgrade the system by installing/upgrading packages\n" - "full-upgrade - upgrade the system by removing/installing/upgrading packages\n" + " full-upgrade - upgrade the system by removing/installing/upgrading packages\n" "\n" " edit-sources - edit the source information file\n" ); @@ -94,7 +69,7 @@ int main(int argc, const char *argv[]) /*{{{*/ { CommandLine::Dispatch Cmds[] = { // query - {"list",&List}, + {"list",&DoList}, {"search", &FullTextSearch}, {"show", &APT::Cmd::ShowPackage}, @@ -120,6 +95,10 @@ int main(int argc, const char *argv[]) /*{{{*/ std::vector Args = getCommandArgs("apt", CommandLine::GetCommand(Cmds, argc, argv)); + // Init the signals + InitSignals(); + + // Init the output InitOutput(); // Set up gettext support @@ -133,20 +112,16 @@ int main(int argc, const char *argv[]) /*{{{*/ } // some different defaults - _config->CndSet("DPkgPM::Progress", "1"); + _config->CndSet("DPkg::Progress-Fancy", "1"); _config->CndSet("Apt::Color", "1"); _config->CndSet("APT::Get::Upgrade-Allow-New", true); + _config->CndSet("APT::Cmd::Show-Update-Stats", true); // Parse the command line and initialize the package library - CommandLine CmdL(Args.data(), _config); - if (CmdL.Parse(argc, argv) == false || - pkgInitSystem(*_config, _system) == false) - { - _error->DumpErrors(); - return 100; - } + CommandLine CmdL; + ParseCommandLine(CmdL, Cmds, Args.data(), NULL, &_system, argc, argv, ShowHelp); - if(!isatty(STDOUT_FILENO) && + if(!isatty(STDOUT_FILENO) && _config->FindB("Apt::Cmd::Disable-Script-Warning", false) == false) { std::cerr << std::endl @@ -156,17 +131,6 @@ int main(int argc, const char *argv[]) /*{{{*/ << std::endl << std::endl; } - if (!isatty(STDOUT_FILENO) && _config->FindI("quiet", -1) == -1) - _config->Set("quiet","1"); - - // See if the help should be shown - if (_config->FindB("help") == true || - _config->FindB("version") == true || - CmdL.FileSize() == 0) - { - ShowHelp(CmdL); - return 0; - } // see if we are in simulate mode CheckSimulateMode(CmdL);