X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/e7e10e47476606e3b2274cf66b1e8ea74b236757..0fb16c3e678044d6d06ba8a6199b1e96487ee0d8:/cmdline/apt-sortpkgs.cc?ds=sidebyside diff --git a/cmdline/apt-sortpkgs.cc b/cmdline/apt-sortpkgs.cc index 93aa5a76b..cf19b84ec 100644 --- a/cmdline/apt-sortpkgs.cc +++ b/cmdline/apt-sortpkgs.cc @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -132,44 +133,34 @@ static bool DoIt(string InFile) return true; } /*}}}*/ -// ShowHelp - Show the help text /*{{{*/ -// --------------------------------------------------------------------- -/* */ -static bool ShowHelp(CommandLine &, CommandLine::DispatchWithHelp const *) +static bool ShowHelp(CommandLine &) /*{{{*/ { - ioprintf(std::cout, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH); - if (_config->FindB("version") == true) - return true; - - cout << + std::cout << _("Usage: apt-sortpkgs [options] file1 [file2 ...]\n" "\n" - "apt-sortpkgs is a simple tool to sort package files. The -s option is used\n" - "to indicate what kind of file it is.\n" - "\n" - "Options:\n" - " -h This help text\n" - " -s Use source file sorting\n" - " -c=? Read this configuration file\n" - " -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp\n"); - + "apt-sortpkgs is a simple tool to sort package information files.\n" + "By default it sorts by binary package information, but the -s option\n" + "can be used to switch to source package ordering instead.\n"); return true; } /*}}}*/ +static std::vector GetCommands() /*{{{*/ +{ + return { + {nullptr, nullptr, nullptr} + }; +} + /*}}}*/ int main(int argc,const char *argv[]) /*{{{*/ { - InitLocale(); - - // Parse the command line and initialize the package library - CommandLine::DispatchWithHelp Cmds[] = {{nullptr, nullptr, nullptr}}; CommandLine CmdL; - ParseCommandLine(CmdL, Cmds, "apt-sortpkgs", &_config, &_system, argc, argv, ShowHelp); + ParseCommandLine(CmdL, APT_CMD::APT_SORTPKG, &_config, &_system, argc, argv, &ShowHelp, &GetCommands); // Match the operation for (unsigned int I = 0; I != CmdL.FileSize(); I++) if (DoIt(CmdL.FileList[I]) == false) break; - return DispatchCommandLine(CmdL, nullptr); + return DispatchCommandLine(CmdL, {}); } /*}}}*/