]>
git.saurik.com Git - apt.git/blob - cmdline/apt.cc
368822d2d7d53009c049c91285be58e159ae0f2d
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 bool ShowHelp(CommandLine
&, aptDispatchWithHelp
const * Cmds
) /*{{{*/
46 _("Usage: apt [options] command\n"
50 ShowHelpListCommands(Cmds
);
54 std::vector
<aptDispatchWithHelp
> GetCommands() /*{{{*/
58 {"list", &DoList
, _("list packages based on package names")},
59 {"search", &DoSearch
, _("search in package descriptions")},
60 {"show", &ShowPackage
, _("show package details")},
63 {"install", &DoInstall
, _("install packages")},
64 {"remove", &DoInstall
, _("remove packages")},
65 {"autoremove", &DoInstall
, _("Remove automatically all unused packages")},
66 {"auto-remove", &DoInstall
, nullptr},
67 {"purge", &DoInstall
, nullptr},
70 {"update", &DoUpdate
, _("update list of available packages")},
71 {"upgrade", &DoUpgrade
, _("upgrade the system by installing/upgrading packages")},
72 {"full-upgrade", &DoDistUpgrade
, _("upgrade the system by removing/installing/upgrading packages")},
75 {"edit-sources", &EditSources
, _("edit the source information file")},
76 {"moo", &DoMoo
, nullptr},
78 // for compat with muscle memory
79 {"dist-upgrade", &DoDistUpgrade
, nullptr},
80 {"showsrc",&ShowSrcPackage
, nullptr},
81 {"depends",&Depends
, nullptr},
82 {"rdepends",&RDepends
, nullptr},
83 {"policy",&Policy
, nullptr},
84 {"build-dep", &DoBuildDep
,nullptr},
85 {"clean", &DoClean
, nullptr},
86 {"autoclean", &DoAutoClean
, nullptr},
87 {"auto-clean", &DoAutoClean
, nullptr},
88 {"source", &DoSource
, nullptr},
89 {"download", &DoDownload
, nullptr},
90 {"changelog", &DoChangelog
, nullptr},
92 {nullptr, nullptr, nullptr}
96 int main(int argc
, const char *argv
[]) /*{{{*/
101 auto const Cmds
= ParseCommandLine(CmdL
, APT_CMD::APT
, &_config
, &_system
, argc
, argv
);
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
);