#include <paludis/paludis.hh>
#include <iostream>
#include <iomanip>
#include <cstdlib>
using namespace examples;
using std::cout;
using std::endl;
using std::left;
using std::setw;
int main(int argc, char * argv[])
{
int exit_status(0);
try
{
"example_environment", "EXAMPLE_ENVIRONMENT_OPTIONS", "EXAMPLE_ENVIRONMENT_CMDLINE");
for (const auto & repository : env->repositories())
{
cout << left << repository->name() << ":" << endl;
cout << left << setw(30) << " Metadata keys:" << endl;
for (const auto & key : repository->metadata())
cout << " " << key->human_name() << endl;
std::shared_ptr<const CategoryNamePartSet> cats(repository->category_names({ }));
cout << left << setw(30) << " Number of categories:" << " " << cats->size() << endl;
std::shared_ptr<const PackageIDSequence> ids(repository->package_ids(
QualifiedPackageName(
"sys-apps/paludis"), { }));
cout << left << setw(30) << " IDs for sys-apps/paludis:" << " " <<
cout << endl;
}
}
{
cout << endl;
cout << "Unhandled exception:" << endl
return EXIT_FAILURE;
}
catch (const std::exception & e)
{
cout << endl;
cout << "Unhandled exception:" << endl
<<
" * " << e.
what() << endl;
return EXIT_FAILURE;
}
catch (...)
{
cout << endl;
cout << "Unhandled exception:" << endl
<< " * Unknown exception type. Ouch..." << endl;
return EXIT_FAILURE;
}
return exit_status;
}
Definition exception.hh:77
std::string backtrace(const std::string &delim) const
const char * what() const noexcept override
const std::string & message() const noexcept
static CommandLine * get_instance() PALUDIS_ATTRIBUTE((warn_unused_result))
IndirectIterator< Iter_ > indirect_iterator(const Iter_ &)
T_ join(I_ i, I_ end, const T_ &joiner)
Definition join.hh:45
Definition about_metadata-fwd.hh:24