]> git.saurik.com Git - apt.git/blame - cmdline/apt.cc
German translation proof read by Helge Kreutzmann
[apt.git] / cmdline / apt.cc
CommitLineData
b9179170
MV
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
3/* ######################################################################
4
5 apt - CLI UI for apt
6
7 Returns 100 on failure, 0 on success.
8
9 ##################################################################### */
10 /*}}}*/
11// Include Files /*{{{*/
12#include<config.h>
13
453b82a3 14#include <apt-pkg/cmndline.h>
b9179170 15#include <apt-pkg/error.h>
b9179170 16#include <apt-pkg/init.h>
b9179170 17#include <apt-pkg/pkgsystem.h>
453b82a3
DK
18#include <apt-pkg/strutl.h>
19#include <apt-pkg/configuration.h>
b9179170
MV
20
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>
9e6b13f3 31#include <apt-private/private-sources.h>
9055d5e6
DK
32#include <apt-private/private-source.h>
33#include <apt-private/private-depends.h>
34#include <apt-private/private-download.h>
b9179170 35
453b82a3
DK
36#include <unistd.h>
37#include <iostream>
38#include <vector>
cfacba52 39
453b82a3
DK
40#include <apti18n.h>
41 /*}}}*/
cfacba52 42
f6777222 43static bool ShowHelp(CommandLine &) /*{{{*/
b9179170 44{
2b0660b5 45 std::cout <<
8561c2fe
DK
46 _("Usage: apt [options] command\n"
47 "\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");
b9179170
MV
53 return true;
54}
011188e3 55 /*}}}*/
f6777222 56static std::vector<aptDispatchWithHelp> GetCommands() /*{{{*/
b9179170 57{
011188e3 58 return {
cbbee23e
DK
59 // query
60 {"list", &DoList, _("list packages based on package names")},
61 {"search", &DoSearch, _("search in package descriptions")},
62 {"show", &ShowPackage, _("show package details")},
63
64 // package stuff
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},
70
71 // system wide stuff
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")},
cbbee23e
DK
75
76 // misc
77 {"edit-sources", &EditSources, _("edit the source information file")},
78 {"moo", &DoMoo, nullptr},
9055d5e6
DK
79
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},
93
cbbee23e
DK
94 {nullptr, nullptr, nullptr}
95 };
011188e3
DK
96}
97 /*}}}*/
98int main(int argc, const char *argv[]) /*{{{*/
99{
ad7e0941 100 CommandLine CmdL;
90986d4d 101 auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT, &_config, &_system, argc, argv, &ShowHelp, &GetCommands);
b9179170 102
2b0660b5
DK
103 int const quiet = _config->FindI("quiet", 0);
104 if (quiet == 2)
105 {
106 _config->CndSet("quiet::NoProgress", true);
107 _config->Set("quiet", 1);
108 }
109
110 InitSignals();
111 InitOutput();
112
e7e10e47
DK
113 CheckIfCalledByScript(argc, argv);
114 CheckIfSimulateMode(CmdL);
b9179170 115
e7e10e47 116 return DispatchCommandLine(CmdL, Cmds);
b9179170
MV
117}
118 /*}}}*/