]>
git.saurik.com Git - apt.git/blob - cmdline/apt.cc
1 // -*- mode: cpp; mode: fold -*-
3 /* ######################################################################
7 Returns 100 on failure, 0 on success.
9 ##################################################################### */
11 // Include Files /*{{{*/
14 #include <apt-pkg/cmndline.h>
15 #include <apt-pkg/error.h>
16 #include <apt-pkg/init.h>
17 #include <apt-pkg/pkgsystem.h>
18 #include <apt-pkg/strutl.h>
19 #include <apt-pkg/configuration.h>
21 #include <apt-private/private-list.h>
22 #include <apt-private/private-search.h>
23 #include <apt-private/private-install.h>
24 #include <apt-private/private-output.h>
25 #include <apt-private/private-update.h>
26 #include <apt-private/private-cmndline.h>
27 #include <apt-private/private-moo.h>
28 #include <apt-private/private-upgrade.h>
29 #include <apt-private/private-show.h>
30 #include <apt-private/private-main.h>
31 #include <apt-private/private-sources.h>
32 #include <apt-private/private-source.h>
33 #include <apt-private/private-depends.h>
34 #include <apt-private/private-download.h>
43 static bool ShowHelp(CommandLine
&) /*{{{*/
46 _("Usage: apt [options] command\n"
48 "apt is a commandline package manager and provides commands for\n"
49 "searching and managing as well as querying information about packages.\n"
50 "It provides the same functionality as the specialized APT tools,\n"
51 "like apt-get and apt-cache, but enables options more suitable for\n"
52 "interactive use by default.\n");
56 static std::vector
<aptDispatchWithHelp
> GetCommands() /*{{{*/
60 {"list", &DoList
, _("list packages based on package names")},
61 {"search", &DoSearch
, _("search in package descriptions")},
62 {"show", &ShowPackage
, _("show package details")},
65 {"install", &DoInstall
, _("install packages")},
66 {"remove", &DoInstall
, _("remove packages")},
67 {"autoremove", &DoInstall
, _("Remove automatically all unused packages")},
68 {"auto-remove", &DoInstall
, nullptr},
69 {"purge", &DoInstall
, nullptr},
72 {"update", &DoUpdate
, _("update list of available packages")},
73 {"upgrade", &DoUpgrade
, _("upgrade the system by installing/upgrading packages")},
74 {"full-upgrade", &DoDistUpgrade
, _("upgrade the system by removing/installing/upgrading packages")},
77 {"edit-sources", &EditSources
, _("edit the source information file")},
78 {"moo", &DoMoo
, nullptr},
80 // for compat with muscle memory
81 {"dist-upgrade", &DoDistUpgrade
, nullptr},
82 {"showsrc",&ShowSrcPackage
, nullptr},
83 {"depends",&Depends
, nullptr},
84 {"rdepends",&RDepends
, nullptr},
85 {"policy",&Policy
, nullptr},
86 {"build-dep", &DoBuildDep
,nullptr},
87 {"clean", &DoClean
, nullptr},
88 {"autoclean", &DoAutoClean
, nullptr},
89 {"auto-clean", &DoAutoClean
, nullptr},
90 {"source", &DoSource
, nullptr},
91 {"download", &DoDownload
, nullptr},
92 {"changelog", &DoChangelog
, nullptr},
94 {nullptr, nullptr, nullptr}
98 int main(int argc
, const char *argv
[]) /*{{{*/
101 auto const Cmds
= ParseCommandLine(CmdL
, APT_CMD::APT
, &_config
, &_system
, argc
, argv
, &ShowHelp
, &GetCommands
);
103 int const quiet
= _config
->FindI("quiet", 0);
106 _config
->CndSet("quiet::NoProgress", true);
107 _config
->Set("quiet", 1);
113 CheckIfCalledByScript(argc
, argv
);
114 CheckIfSimulateMode(CmdL
);
116 return DispatchCommandLine(CmdL
, Cmds
);