diff options
author | 2011-09-14 09:22:50 +0100 | |
---|---|---|
committer | 2011-09-14 09:57:40 +0100 | |
commit | cabf80cc5dfeb84eef7c4d7784eee0dc87de6d5e (patch) | |
tree | 05a370d70ee2c8aee9d6bdf44a0a4f1a94dff5cc | |
parent | 81d87f2466fcccf199a0a7363062eab649acb87a (diff) | |
download | paludis-cabf80cc5dfeb84eef7c4d7784eee0dc87de6d5e.tar.gz paludis-cabf80cc5dfeb84eef7c4d7784eee0dc87de6d5e.tar.xz |
Maintainers as objects
-rw-r--r-- | doc/api/cplusplus/examples/example_metadata_key.cc | 7 | ||||
-rw-r--r-- | paludis/files.m4 | 1 | ||||
-rw-r--r-- | paludis/formatted_pretty_printer.cc | 6 | ||||
-rw-r--r-- | paludis/formatted_pretty_printer.hh | 2 | ||||
-rw-r--r-- | paludis/literal_metadata_key.cc | 60 | ||||
-rw-r--r-- | paludis/literal_metadata_key.hh | 34 | ||||
-rw-r--r-- | paludis/maintainer-fwd.hh | 36 | ||||
-rw-r--r-- | paludis/maintainer.cc | 43 | ||||
-rw-r--r-- | paludis/maintainer.hh | 54 | ||||
-rw-r--r-- | paludis/metadata_key.cc | 2 | ||||
-rw-r--r-- | paludis/metadata_key.hh | 2 | ||||
-rw-r--r-- | paludis/pretty_printer.hh | 5 | ||||
-rw-r--r-- | paludis/unformatted_pretty_printer.cc | 9 | ||||
-rw-r--r-- | paludis/unformatted_pretty_printer.hh | 4 | ||||
-rw-r--r-- | paludis/user_dep_spec.cc | 14 | ||||
-rw-r--r-- | python/metadata_key.cc | 44 | ||||
-rw-r--r-- | ruby/metadata_key.cc | 17 | ||||
-rwxr-xr-x | src/clients/cave/cmd_display_resolution.cc | 6 | ||||
-rw-r--r-- | src/clients/cave/cmd_info.cc | 6 | ||||
-rw-r--r-- | src/clients/cave/cmd_match.cc | 5 | ||||
-rw-r--r-- | src/clients/cave/cmd_show.cc | 13 | ||||
-rw-r--r-- | src/clients/cave/format_plain_metadata_key.cc | 5 |
22 files changed, 371 insertions, 4 deletions
diff --git a/doc/api/cplusplus/examples/example_metadata_key.cc b/doc/api/cplusplus/examples/example_metadata_key.cc index fffa6ea13..264317b7c 100644 --- a/doc/api/cplusplus/examples/example_metadata_key.cc +++ b/doc/api/cplusplus/examples/example_metadata_key.cc @@ -172,6 +172,13 @@ namespace cout << indent << left << setw(30) << " Value:" << " " << join(value->begin(), value->end(), " ") << endl; } + void visit(const MetadataCollectionKey<Maintainers> & key) + { + auto value(key.parse_value()); + cout << indent << left << setw(30) << " Class:" << " " << "MetadataCollectionKey<Maintainers>" << endl; + cout << indent << left << setw(30) << " Value:" << " " << join(value->begin(), value->end(), " ") << endl; + } + void visit(const MetadataCollectionKey<FSPathSequence> & key) { auto value(key.parse_value()); diff --git a/paludis/files.m4 b/paludis/files.m4 index 22052c86a..d97a60dbe 100644 --- a/paludis/files.m4 +++ b/paludis/files.m4 @@ -60,6 +60,7 @@ add(`ipc_output_manager', `hh', `cc', `fwd') add(`libtool_linkage_checker', `hh', `cc') add(`linkage_checker', `hh', `cc') add(`literal_metadata_key', `hh', `cc') +add(`maintainer', `hh', `cc', `fwd') add(`mask', `hh', `cc', `fwd', `se') add(`mask_utils', `hh', `cc', `fwd') add(`match_package', `hh', `cc', `se', `fwd') diff --git a/paludis/formatted_pretty_printer.cc b/paludis/formatted_pretty_printer.cc index 99220f8b2..f73885876 100644 --- a/paludis/formatted_pretty_printer.cc +++ b/paludis/formatted_pretty_printer.cc @@ -205,6 +205,12 @@ FormattedPrettyPrinter::prettify(const std::string & v) const } const std::string +FormattedPrettyPrinter::prettify(const Maintainer & v) const +{ + return format_plain(stringify(v)); +} + +const std::string FormattedPrettyPrinter::prettify(const std::pair<const std::string, std::string> & v) const { if (v.first.empty()) diff --git a/paludis/formatted_pretty_printer.hh b/paludis/formatted_pretty_printer.hh index 5b98a45a1..a8f55fd88 100644 --- a/paludis/formatted_pretty_printer.hh +++ b/paludis/formatted_pretty_printer.hh @@ -74,6 +74,8 @@ namespace paludis virtual const std::string prettify(const FSPath &) const; virtual const std::string prettify(const KeywordName &) const; + + virtual const std::string prettify(const Maintainer &) const; }; } diff --git a/paludis/literal_metadata_key.cc b/paludis/literal_metadata_key.cc index 889499ea8..a670d4e11 100644 --- a/paludis/literal_metadata_key.cc +++ b/paludis/literal_metadata_key.cc @@ -123,6 +123,24 @@ namespace paludis { } }; + + template <> + struct Imp<LiteralMetadataMaintainersKey> + { + const std::string raw_name; + const std::string human_name; + const MetadataKeyType type; + const std::shared_ptr<const Maintainers> value; + + Imp(const std::string & r, const std::string & h, const MetadataKeyType t, + const std::shared_ptr<const Maintainers> & v) : + raw_name(r), + human_name(h), + type(t), + value(v) + { + } + }; } LiteralMetadataFSPathSequenceKey::LiteralMetadataFSPathSequenceKey(const std::string & r, const std::string & h, @@ -399,6 +417,47 @@ LiteralMetadataTimeKey::parse_value() const return _imp->value; } +LiteralMetadataMaintainersKey::LiteralMetadataMaintainersKey(const std::string & r, const std::string & h, + const MetadataKeyType t, const std::shared_ptr<const Maintainers> & v) : + _imp(r, h, t, v) +{ +} + +LiteralMetadataMaintainersKey::~LiteralMetadataMaintainersKey() +{ +} + +const std::shared_ptr<const Maintainers> +LiteralMetadataMaintainersKey::parse_value() const +{ + return _imp->value; +} + +const std::string +LiteralMetadataMaintainersKey::pretty_print_value( + const PrettyPrinter & p, const PrettyPrintOptions &) const +{ + return join(_imp->value->begin(), _imp->value->end(), " ", CallPrettyPrinter(p)); +} + +const std::string +LiteralMetadataMaintainersKey::human_name() const +{ + return _imp->human_name; +} + +const std::string +LiteralMetadataMaintainersKey::raw_name() const +{ + return _imp->raw_name; +} + +MetadataKeyType +LiteralMetadataMaintainersKey::type() const +{ + return _imp->type; +} + namespace paludis { template class LiteralMetadataValueKey<FSPath>; @@ -408,3 +467,4 @@ namespace paludis template class LiteralMetadataValueKey<long>; template class LiteralMetadataValueKey<std::shared_ptr<const PackageID> >; } + diff --git a/paludis/literal_metadata_key.hh b/paludis/literal_metadata_key.hh index 9a581cb18..2d81b114f 100644 --- a/paludis/literal_metadata_key.hh +++ b/paludis/literal_metadata_key.hh @@ -249,6 +249,40 @@ namespace paludis const PrettyPrinter &, const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result)); }; + + /** + * A LiteralMetadataMaintainersKey is a MetadataCollectionKey<Maintainers> + * whose value is known at construction time. + * + * \ingroup g_literal_metadata_key + * \since 0.68 + */ + class PALUDIS_VISIBLE LiteralMetadataMaintainersKey : + public MetadataCollectionKey<Maintainers> + { + private: + Pimp<LiteralMetadataMaintainersKey> _imp; + + public: + ///\name Basic operations + ///\{ + + LiteralMetadataMaintainersKey(const std::string &, const std::string &, const MetadataKeyType, + const std::shared_ptr<const Maintainers> &); + ~LiteralMetadataMaintainersKey(); + + ///\} + + virtual const std::shared_ptr<const Maintainers> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)); + + virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); + virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); + virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result)); + + virtual const std::string pretty_print_value( + const PrettyPrinter &, + const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result)); + }; } #endif diff --git a/paludis/maintainer-fwd.hh b/paludis/maintainer-fwd.hh new file mode 100644 index 000000000..184bb2c41 --- /dev/null +++ b/paludis/maintainer-fwd.hh @@ -0,0 +1,36 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2011 Ciaran McCreesh + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PALUDIS_GUARD_PALUDIS_MAINTAINER_FWD_HH +#define PALUDIS_GUARD_PALUDIS_MAINTAINER_FWD_HH 1 + +#include <paludis/util/sequence-fwd.hh> +#include <paludis/util/attributes.hh> +#include <iosfwd> + +namespace paludis +{ + struct Maintainer; + + typedef Sequence<Maintainer> Maintainers; + + std::ostream & operator<< (std::ostream &, const Maintainer &) PALUDIS_VISIBLE; +} + +#endif diff --git a/paludis/maintainer.cc b/paludis/maintainer.cc new file mode 100644 index 000000000..33a555b1b --- /dev/null +++ b/paludis/maintainer.cc @@ -0,0 +1,43 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2011 Ciaran McCreesh + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <paludis/maintainer.hh> +#include <paludis/util/sequence-impl.hh> +#include <paludis/util/wrapped_forward_iterator-impl.hh> +#include <ostream> + +using namespace paludis; + +std::ostream & +paludis::operator<< (std::ostream & s, const Maintainer & m) +{ + if (! m.author().empty()) + s << m.author() << " "; + s << "<" << m.email() << ">"; + if (! m.description().empty()) + s << " (" + m.description() + ")"; + return s; +} + +namespace paludis +{ + template class Sequence<Maintainer>; + template class WrappedForwardIterator<Sequence<Maintainer>::ConstIteratorTag, const Maintainer>; +} + diff --git a/paludis/maintainer.hh b/paludis/maintainer.hh new file mode 100644 index 000000000..cca6dc266 --- /dev/null +++ b/paludis/maintainer.hh @@ -0,0 +1,54 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2011 Ciaran McCreesh + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PALUDIS_GUARD_PALUDIS_MAINTAINER_HH +#define PALUDIS_GUARD_PALUDIS_MAINTAINER_HH 1 + +#include <paludis/maintainer-fwd.hh> +#include <paludis/util/sequence.hh> +#include <paludis/util/wrapped_forward_iterator.hh> +#include <paludis/util/named_value.hh> + +namespace paludis +{ + namespace n + { + typedef Name<struct name_author> author; + typedef Name<struct name_description> description; + typedef Name<struct name_email> email; + } + + /** + * Represents a package maintainer. + * + * \since 0.68 + * \ingroup g_metadata_key + */ + struct Maintainer + { + NamedValue<n::author, std::string> author; + NamedValue<n::description, std::string> description; + NamedValue<n::email, std::string> email; + }; + + extern template class Sequence<Maintainer>; + extern template class WrappedForwardIterator<Sequence<Maintainer>::ConstIteratorTag, const Maintainer>; +} + +#endif diff --git a/paludis/metadata_key.cc b/paludis/metadata_key.cc index 2f009e549..9694275fe 100644 --- a/paludis/metadata_key.cc +++ b/paludis/metadata_key.cc @@ -75,6 +75,7 @@ namespace paludis template class MetadataCollectionKey<Map<std::string, std::string> >; template class MetadataCollectionKey<PackageIDSequence>; template class MetadataCollectionKey<FSPathSequence>; + template class MetadataCollectionKey<Maintainers>; template class MetadataSpecTreeKey<LicenseSpecTree>; template class MetadataSpecTreeKey<PlainTextSpecTree>; @@ -93,3 +94,4 @@ namespace paludis template class MetadataValueKey<std::shared_ptr<const PackageID> >; template class MetadataValueKey<std::shared_ptr<const Choices> >; } + diff --git a/paludis/metadata_key.hh b/paludis/metadata_key.hh index ad7794288..8b17c3c27 100644 --- a/paludis/metadata_key.hh +++ b/paludis/metadata_key.hh @@ -31,6 +31,7 @@ #include <paludis/choice-fwd.hh> #include <paludis/pretty_printer-fwd.hh> #include <paludis/pretty_print_options-fwd.hh> +#include <paludis/maintainer-fwd.hh> #include <paludis/util/fs_path-fwd.hh> #include <paludis/util/attributes.hh> #include <paludis/util/remove_shared_ptr.hh> @@ -91,6 +92,7 @@ namespace paludis MetadataCollectionKey<PackageIDSequence>, MetadataCollectionKey<FSPathSequence>, MetadataCollectionKey<Map<std::string, std::string> >, + MetadataCollectionKey<Maintainers>, MetadataSpecTreeKey<DependencySpecTree>, MetadataSpecTreeKey<LicenseSpecTree>, MetadataSpecTreeKey<FetchableURISpecTree>, diff --git a/paludis/pretty_printer.hh b/paludis/pretty_printer.hh index 9369d1bad..043c4dd39 100644 --- a/paludis/pretty_printer.hh +++ b/paludis/pretty_printer.hh @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2010 Ciaran McCreesh + * Copyright (c) 2010, 2011 Ciaran McCreesh * * This file is part of the Paludis package manager. Paludis is free software; * you can redistribute it and/or modify it under the terms of the GNU General @@ -26,6 +26,7 @@ #include <paludis/dep_spec-fwd.hh> #include <paludis/package_id-fwd.hh> #include <paludis/name-fwd.hh> +#include <paludis/maintainer-fwd.hh> #include <string> #include <memory> @@ -68,6 +69,8 @@ namespace paludis virtual const std::string prettify(const FSPath &) const = 0; virtual const std::string prettify(const KeywordName &) const = 0; + + virtual const std::string prettify(const Maintainer &) const = 0; }; } diff --git a/paludis/unformatted_pretty_printer.cc b/paludis/unformatted_pretty_printer.cc index 793cf77bc..a66d257e8 100644 --- a/paludis/unformatted_pretty_printer.cc +++ b/paludis/unformatted_pretty_printer.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2010 Ciaran McCreesh + * Copyright (c) 2010, 2011 Ciaran McCreesh * * This file is part of the Paludis package manager. Paludis is free software; * you can redistribute it and/or modify it under the terms of the GNU General @@ -20,6 +20,7 @@ #include <paludis/unformatted_pretty_printer.hh> #include <paludis/util/stringify.hh> #include <paludis/name.hh> +#include <paludis/maintainer.hh> using namespace paludis; @@ -148,3 +149,9 @@ UnformattedPrettyPrinter::prettify(const KeywordName & v) const return stringify(v); } +const std::string +UnformattedPrettyPrinter::prettify(const Maintainer & v) const +{ + return stringify(v); +} + diff --git a/paludis/unformatted_pretty_printer.hh b/paludis/unformatted_pretty_printer.hh index a9de9b09f..113e54d49 100644 --- a/paludis/unformatted_pretty_printer.hh +++ b/paludis/unformatted_pretty_printer.hh @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2010 Ciaran McCreesh + * Copyright (c) 2010, 2011 Ciaran McCreesh * * This file is part of the Paludis package manager. Paludis is free software; * you can redistribute it and/or modify it under the terms of the GNU General @@ -58,6 +58,8 @@ namespace paludis virtual const std::string prettify(const FSPath &) const; virtual const std::string prettify(const KeywordName &) const; + + virtual const std::string prettify(const Maintainer &) const; }; } diff --git a/paludis/user_dep_spec.cc b/paludis/user_dep_spec.cc index 6d8400514..4e810d0d6 100644 --- a/paludis/user_dep_spec.cc +++ b/paludis/user_dep_spec.cc @@ -820,6 +820,20 @@ namespace return false; } + + bool visit(const MetadataCollectionKey<Maintainers> & s) const + { + auto v(s.parse_value()); + switch (op) + { + case '=': + return pattern == join(v->begin(), v->end(), " "); + case '<': + return v->end() != std::find_if(v->begin(), v->end(), StringifyEqual(pattern)); + } + + return false; + } }; struct AssociatedKeyFinder diff --git a/python/metadata_key.cc b/python/metadata_key.cc index 3bb6eb4fd..0aa641d72 100644 --- a/python/metadata_key.cc +++ b/python/metadata_key.cc @@ -19,11 +19,13 @@ #include <python/paludis_python.hh> #include <python/exception.hh> +#include <python/iterable.hh> #include <paludis/metadata_key.hh> #include <paludis/name.hh> #include <paludis/dep_label.hh> #include <paludis/environment.hh> +#include <paludis/maintainer.hh> #include <paludis/util/set.hh> #include <paludis/util/sequence.hh> #include <paludis/util/timestamp.hh> @@ -110,6 +112,11 @@ class MetadataKeySptrToPythonVisitor obj = bp::object(std::static_pointer_cast<const MetadataCollectionKey<FSPathSequence> >(_m_ptr)); } + void visit(const MetadataCollectionKey<Maintainers> & k) + { + obj = bp::object(std::static_pointer_cast<const MetadataCollectionKey<Maintainers> >(_m_ptr)); + } + void visit(const MetadataSpecTreeKey<LicenseSpecTree> & k) { obj = bp::object(std::static_pointer_cast<const MetadataSpecTreeKey<LicenseSpecTree> >(_m_ptr)); @@ -1135,6 +1142,7 @@ void expose_metadata_key() class_set_key<Sequence<std::string> >("StringIterable", "StringSequence"); class_set_key<FSPathSequence>("FSPathIterable", "FSPathIterable"); class_set_key<PackageIDSequence>("PackageIDIterable", "PackageIDIterable"); + class_set_key<Maintainers>("MaintainerIterable", "MaintainerIterable"); /** * MetadataSpecTreeKeys @@ -1145,5 +1153,41 @@ void expose_metadata_key() class_spec_tree_key<RequiredUseSpecTree>("RequiredUseSpecTree"); class_spec_tree_key<SimpleURISpecTree>("SimpleURISpecTree"); class_spec_tree_key<FetchableURISpecTree>("FetchableURISpecTree"); + + /** + * Maintainers + */ + class_iterable<Maintainers> + ( + "MaintainerIterable", + "Iterable of Maintainer", + true + ); + + /** + * Maintainer + */ + bp::class_<Maintainer> maintainer( + "Maintainer", + "Represents a package maintainer", + bp::no_init + ); + + maintainer + .add_property("author", + &named_values_getter<Maintainer, n::author, std::string, &Maintainer::author>, + "[ro] String\n" + ) + + .add_property("description", + &named_values_getter<Maintainer, n::description, std::string, &Maintainer::description>, + "[ro] String\n" + ) + + .add_property("email", + &named_values_getter<Maintainer, n::email, std::string, &Maintainer::email>, + "[ro] String\n" + ) + ; } diff --git a/ruby/metadata_key.cc b/ruby/metadata_key.cc index b2bc74089..dba7cfae4 100644 --- a/ruby/metadata_key.cc +++ b/ruby/metadata_key.cc @@ -48,6 +48,7 @@ namespace static VALUE c_metadata_package_id_sequence_key; static VALUE c_metadata_fsentry_key; static VALUE c_metadata_fsentry_sequence_key; + static VALUE c_metadata_maintainers_key; static VALUE c_metadata_key_type; static VALUE c_metadata_license_spec_tree_key; static VALUE c_metadata_fetchable_uri_spec_tree_key; @@ -186,6 +187,12 @@ namespace new std::shared_ptr<const MetadataKey>(mm)); } + void visit(const MetadataCollectionKey<Maintainers> &) + { + value = Data_Wrap_Struct(c_metadata_maintainers_key, 0, &Common<std::shared_ptr<const MetadataKey> >::free, + new std::shared_ptr<const MetadataKey>(mm)); + } + void visit(const MetadataCollectionKey<PackageIDSequence> &) { value = Data_Wrap_Struct(c_metadata_package_id_sequence_key, 0, &Common<std::shared_ptr<const MetadataKey> >::free, @@ -688,7 +695,15 @@ namespace * Metadata class for filesystem sequences. */ c_metadata_fsentry_sequence_key = rb_define_class_under(paludis_module(), "MetadataFSPathSequenceKey", c_metadata_key); - rb_define_method(c_metadata_fsentry_sequence_key, "parse_value", RUBY_FUNC_CAST((&SetValue<FSPathSequence>::fetch)), 0); + rb_define_method(c_metadata_fsentry_sequence_key, "parse_value", RUBY_FUNC_CAST((&SetValue<Maintainers>::fetch)), 0); + + /* + * Document-class: Paludis::MetadataMaintainersKey + * + * Metadata class for maintainers. + */ + c_metadata_maintainers_key = rb_define_class_under(paludis_module(), "MetadataMaintainersKey", c_metadata_key); + rb_define_method(c_metadata_maintainers_key, "parse_value", RUBY_FUNC_CAST((&SetValue<FSPathSequence>::fetch)), 0); /* * Document-class: Paludis::MetadataStringSetKey diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc index 04fece641..b0cd10ce0 100755 --- a/src/clients/cave/cmd_display_resolution.cc +++ b/src/clients/cave/cmd_display_resolution.cc @@ -951,6 +951,12 @@ namespace cout << fuc(fs_mask_by(), fv<'i'>(indent), fv<'k'>(k.human_name()), fv<'v'>(stringify(k.pretty_print_value(printer, { })))); } + void visit(const MetadataCollectionKey<Maintainers> & k) + { + ColourPrettyPrinter printer(env, id, 0); + cout << fuc(fs_mask_by(), fv<'i'>(indent), fv<'k'>(k.human_name()), fv<'v'>(stringify(k.pretty_print_value(printer, { })))); + } + void visit(const MetadataCollectionKey<FSPathSequence> & k) { ColourPrettyPrinter printer(env, id, 0); diff --git a/src/clients/cave/cmd_info.cc b/src/clients/cave/cmd_info.cc index ad0e698ad..075727f05 100644 --- a/src/clients/cave/cmd_info.cc +++ b/src/clients/cave/cmd_info.cc @@ -198,6 +198,12 @@ namespace cout << fuc(fs_metadata(), fv<'h'>(k.human_name()), fv<'i'>(std::string(indent, ' ')), fv<'s'>(join(v->begin(), v->end(), " "))); } + void visit(const MetadataCollectionKey<Maintainers> & k) + { + auto v(k.parse_value()); + cout << fuc(fs_metadata(), fv<'h'>(k.human_name()), fv<'i'>(std::string(indent, ' ')), fv<'s'>(join(v->begin(), v->end(), " "))); + } + void visit(const MetadataSpecTreeKey<LicenseSpecTree> & k) { ColourPrettyPrinter printer(env, make_null_shared_ptr(), indent); diff --git a/src/clients/cave/cmd_match.cc b/src/clients/cave/cmd_match.cc index 88b01ab04..adc9f7ec2 100644 --- a/src/clients/cave/cmd_match.cc +++ b/src/clients/cave/cmd_match.cc @@ -366,6 +366,11 @@ namespace std::back_inserter(texts), &stringify<PackageID>); } + void visit(const MetadataCollectionKey<Maintainers> & k) + { + auto v(k.parse_value()); + std::transform(v->begin(), v->end(), std::back_inserter(texts), &stringify<Maintainer>); + } }; } diff --git a/src/clients/cave/cmd_show.cc b/src/clients/cave/cmd_show.cc index a78d9fbee..b519c0f08 100644 --- a/src/clients/cave/cmd_show.cc +++ b/src/clients/cave/cmd_show.cc @@ -502,6 +502,19 @@ namespace ); } + void visit(const MetadataCollectionKey<Maintainers> & k) + { + ColourPrettyPrinter printer(env.get(), maybe_current_id, indent); + out << fuc( + (cmdline.a_raw_names.specified() ? fs_metadata_value_raw() : fs_metadata_value_human()), + fv<'s'>(cmdline.a_raw_names.specified() ? k.raw_name() : k.human_name()), + fv<'v'>(k.pretty_print_value(printer, basic_ppos)), + fv<'i'>(std::string(indent, ' ')), + fv<'b'>(important ? "true" : ""), + fv<'p'>("") + ); + } + void visit(const MetadataCollectionKey<PackageIDSequence> & k) { ColourPrettyPrinter printer(env.get(), maybe_current_id, indent); diff --git a/src/clients/cave/format_plain_metadata_key.cc b/src/clients/cave/format_plain_metadata_key.cc index a2699d697..8587a1cef 100644 --- a/src/clients/cave/format_plain_metadata_key.cc +++ b/src/clients/cave/format_plain_metadata_key.cc @@ -120,6 +120,11 @@ namespace s << k.pretty_print_value(UnformattedPrettyPrinter(), { }); } + void visit(const MetadataCollectionKey<Maintainers> & k) + { + s << k.pretty_print_value(UnformattedPrettyPrinter(), { }); + } + void visit(const MetadataCollectionKey<Sequence<std::string> > & k) { s << k.pretty_print_value(UnformattedPrettyPrinter(), { }); |