return true;
}
/*}}}*/
-// ShowHelp - Show a help screen /*{{{*/
-static bool ShowHelp(CommandLine &, CommandLine::DispatchWithHelp const * Cmds)
+bool ShowHelp(CommandLine &, aptDispatchWithHelp const * Cmds) /*{{{*/
{
- ioprintf(std::cout, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH);
-
std::cout <<
_("Usage: apt-mark [options] {auto|manual} pkg1 [pkg2 ...]\n"
"\n"
"apt-mark is a simple command line interface for marking packages\n"
"as manually or automatically installed. It can also list marks.\n")
- << std::endl
- << _("Commands:") << std::endl;
-
- for (; Cmds->Handler != nullptr; ++Cmds)
- {
- if (Cmds->Help == nullptr)
- continue;
- std::cout << " " << Cmds->Match << " - " << Cmds->Help << std::endl;
- }
-
+ << std::endl;
+ ShowHelpListCommands(Cmds);
std::cout << std::endl
<< _("Options:\n"
" -h This help text.\n"
return true;
}
/*}}}*/
-int main(int argc,const char *argv[]) /*{{{*/
+std::vector<aptDispatchWithHelp> GetCommands() /*{{{*/
{
- InitLocale();
-
- CommandLine::DispatchWithHelp Cmds[] = {
+ return {
{"auto",&DoAuto, _("Mark the given packages as automatically installed")},
{"manual",&DoAuto, _("Mark the given packages as manually installed")},
{"hold",&DoSelection, _("Mark a package as held back")},
{"unmarkauto", &DoMarkAuto, nullptr},
{nullptr, nullptr, nullptr}
};
+}
+ /*}}}*/
+int main(int argc,const char *argv[]) /*{{{*/
+{
+ InitLocale();
CommandLine CmdL;
- ParseCommandLine(CmdL, Cmds, "apt-mark", &_config, &_system, argc, argv, ShowHelp);
+ auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT_MARK, &_config, &_system, argc, argv);
InitOutput();