diff options
author | 2009-09-02 17:17:41 +0100 | |
---|---|---|
committer | 2009-09-02 17:17:41 +0100 | |
commit | 9e23047346d2d7f8e3de4aa21e7915158ec1e413 (patch) | |
tree | 8f05c3ddbc953f8405770d089394f3dee8bb03df | |
parent | cc02729c347c1bc8d2a3ef8b939fe298588aa30b (diff) | |
download | paludis-9e23047346d2d7f8e3de4aa21e7915158ec1e413.tar.gz paludis-9e23047346d2d7f8e3de4aa21e7915158ec1e413.tar.xz |
Support args sections
50 files changed, 356 insertions, 181 deletions
diff --git a/doc/api/cplusplus/examples/example_command_line.cc b/doc/api/cplusplus/examples/example_command_line.cc index 2a82cc131..b033af76e 100644 --- a/doc/api/cplusplus/examples/example_command_line.cc +++ b/doc/api/cplusplus/examples/example_command_line.cc @@ -21,13 +21,13 @@ template class InstantiationPolicy<CommandLine, instantiation_method::SingletonT CommandLine::CommandLine() : ArgsHandler(), - action_args(this, "Actions", + action_args(main_options_section(), "Actions", "Selects which basic action to perform. At most one action should " "be specified."), a_version(&action_args, "version", 'V', "Display program version", false), a_help(&action_args, "help", 'h', "Display program help", false), - general_args(this, "General options", + general_args(main_options_section(), "General options", "Options which are relevant for most or all actions."), a_log_level(&general_args, "log-level", '\0'), a_environment(&general_args, "environment", 'E', "Environment specification (class:suffix, both parts optional)") diff --git a/paludis/args/Makefile.am b/paludis/args/Makefile.am index 460c849ed..501696a5c 100644 --- a/paludis/args/Makefile.am +++ b/paludis/args/Makefile.am @@ -17,6 +17,7 @@ paludis_args_include_HEADERS = \ args_handler.hh \ args_handler-se.hh \ args_option.hh \ + args_section.hh \ bad_argument.hh \ args_visitor.hh \ args_dumper.hh \ @@ -33,6 +34,7 @@ libpaludisargs_@PALUDIS_PC_SLOT@_la_SOURCES = \ args_group.cc \ args_handler.cc \ args_option.cc \ + args_section.cc \ bad_argument.cc \ args_visitor.cc \ args_dumper.cc \ diff --git a/paludis/args/args.hh b/paludis/args/args.hh index 23306b1d3..6912847ad 100644 --- a/paludis/args/args.hh +++ b/paludis/args/args.hh @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh + * Copyright (c) 2005, 2006, 2007, 2009 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 @@ -33,6 +33,7 @@ #include <paludis/args/args_error.hh> #include <paludis/args/args_group.hh> #include <paludis/args/args_handler.hh> +#include <paludis/args/args_section.hh> #include <paludis/args/args_option.hh> #include <paludis/args/bad_argument.hh> diff --git a/paludis/args/args_TEST.cc b/paludis/args/args_TEST.cc index 7e0b022ef..1a2b257f9 100644 --- a/paludis/args/args_TEST.cc +++ b/paludis/args/args_TEST.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh + * Copyright (c) 2005, 2006, 2007, 2009 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 @@ -76,13 +76,13 @@ struct CommandLine : public ArgsHandler }; CommandLine::CommandLine() : - group_one(this, "Group one", "Description of group one"), + group_one(main_options_section(), "Group one", "Description of group one"), arg_foo(&group_one, "foo", 'f', "Enable foo", false), arg_bar(&group_one, "bar", 'b', "Enable bar", false), arg_dummy(&group_one, "dummy", 'd', "Enable something else", false), arg_removed(&group_one, "removed", 'r', "Removed", false), - group_two(this, "Group two", "Description of group two"), + group_two(main_options_section(), "Group two", "Description of group two"), arg_baz(&group_two, "baz", 'z', "Enable baz", false), arg_other_baz(&arg_baz, "other-baz"), arg_something(&group_two, "something", 's', "Value of something", false), @@ -93,7 +93,7 @@ CommandLine::CommandLine() : EnumArg::EnumArgOptions("one", "Option one")("two", "option two")("three", "option three"), "two"), arg_spider(&group_two, "spider", '\0', "A spider?", true), - group_three(this, "Group three", "Description of group three"), + group_three(main_options_section(), "Group three", "Description of group three"), arg_other_enum(&group_three, "something", '\0', "Blah.", EnumArg::EnumArgOptions("a", "A")("b", "B")("c", "C"), "b"), arg_stringset(&group_three, "stringset", 't', "A StringSet.") { diff --git a/paludis/args/args_group.cc b/paludis/args/args_group.cc index 096ac067d..12faa3fb5 100644 --- a/paludis/args/args_group.cc +++ b/paludis/args/args_group.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh + * Copyright (c) 2005, 2006, 2007, 2009 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 @@ -41,14 +41,14 @@ namespace paludis }; } -ArgsGroup::ArgsGroup(ArgsHandler * h, const std::string & our_name, +ArgsGroup::ArgsGroup(ArgsSection * s, const std::string & our_name, const std::string & our_description) : PrivateImplementationPattern<ArgsGroup>(new Implementation<ArgsGroup>), _name(our_name), _description(our_description), - _handler(h) + _section(s) { - h->add(this); + s->add(this); } void diff --git a/paludis/args/args_group.hh b/paludis/args/args_group.hh index 465637742..706c59f81 100644 --- a/paludis/args/args_group.hh +++ b/paludis/args/args_group.hh @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh + * Copyright (c) 2005, 2006, 2007, 2009 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 @@ -40,7 +40,7 @@ namespace paludis namespace args { - class ArgsHandler; + class ArgsSection; /** * Contains a related group of command line arguments. @@ -56,15 +56,15 @@ namespace paludis const std::string _name; const std::string _description; - ArgsHandler * _handler; + ArgsSection * _section; public: /** - * Fetch our handler. + * Fetch our section. */ - ArgsHandler * handler() + ArgsSection * section() const { - return _handler; + return _section; } /** @@ -93,7 +93,7 @@ namespace paludis ///\name Basic operations ///\{ - ArgsGroup(ArgsHandler * h, const std::string & name, + ArgsGroup(ArgsSection * s, const std::string & name, const std::string & description); ~ArgsGroup(); @@ -115,14 +115,6 @@ namespace paludis { return _description; } - - /** - * Fetch our handler. - */ - ArgsHandler * handler() const - { - return _handler; - } }; } } diff --git a/paludis/args/args_handler.cc b/paludis/args/args_handler.cc index 4df6b3032..8f6794a0a 100644 --- a/paludis/args/args_handler.cc +++ b/paludis/args/args_handler.cc @@ -27,6 +27,7 @@ #include <paludis/util/create_iterator-impl.hh> #include <paludis/util/indirect_iterator-impl.hh> #include <paludis/util/accept_visitor.hh> +#include <tr1/memory> #include <algorithm> #include <sstream> #include <list> @@ -41,7 +42,7 @@ template class WrappedForwardIterator<ArgsHandler::EnvironmentLineConstIteratorT const std::pair<std::string, std::string> >; template class WrappedForwardIterator<ArgsHandler::ExamplesConstIteratorTag, const std::pair<std::string, std::string> >; -template class WrappedForwardIterator<ArgsHandler::ArgsGroupsConstIteratorTag, ArgsGroup * const>; +template class WrappedForwardIterator<ArgsHandler::ArgsSectionsConstIteratorTag, const ArgsSection>; template class WrappedForwardIterator<ArgsHandler::NotesIteratorTag, const std::string>; template class WrappedForwardIterator<ArgsHandler::DescriptionLineConstIterator, const std::string>; @@ -55,7 +56,7 @@ namespace paludis template<> struct Implementation<ArgsHandler> { - std::list<ArgsGroup *> groups; + std::list<ArgsSection *> sections; std::list<std::string> parameters; std::list<std::string> usage_lines; std::list<std::pair<std::string, std::string> > environment_lines; @@ -65,6 +66,8 @@ namespace paludis std::map<std::string, ArgsOption *> longopts; std::map<char, ArgsOption *> shortopts; + + std::tr1::shared_ptr<ArgsSection> main_options_section; }; } @@ -102,10 +105,9 @@ ArgsHandler::add_note(const std::string & e) } void -ArgsHandler::add(ArgsGroup * const g) +ArgsHandler::add(ArgsSection * const s) { - /// \bug Should check for name uniqueness. - _imp->groups.push_back(g); + _imp->sections.push_back(s); } void @@ -220,14 +222,18 @@ void ArgsHandler::dump_to_stream(std::ostream & s) const { ArgsDumper dump(s); - std::list<ArgsGroup *>::const_iterator g(_imp->groups.begin()), g_end(_imp->groups.end()); - for ( ; g != g_end ; ++g) + for (ArgsSectionsConstIterator a(begin_args_sections()), a_end(end_args_sections()) ; + a != a_end ; ++a) { - s << (*g)->name() << ":" << std::endl; + for (ArgsSection::GroupsConstIterator g(a->begin()), g_end(a->end()) ; + g != g_end ; ++g) + { + s << g->name() << ":" << std::endl; - std::for_each(indirect_iterator((*g)->begin()), indirect_iterator((*g)->end()), accept_visitor(dump)); + std::for_each(indirect_iterator(g->begin()), indirect_iterator(g->end()), accept_visitor(dump)); - s << std::endl; + s << std::endl; + } } } @@ -321,16 +327,24 @@ ArgsHandler::end_notes() const return NotesIterator(_imp->notes.end()); } -ArgsHandler::ArgsGroupsConstIterator -ArgsHandler::begin_args_groups() const +ArgsHandler::ArgsSectionsConstIterator +ArgsHandler::begin_args_sections() const +{ + return ArgsSectionsConstIterator(indirect_iterator(_imp->sections.begin())); +} + +ArgsHandler::ArgsSectionsConstIterator +ArgsHandler::end_args_sections() const { - return ArgsGroupsConstIterator(_imp->groups.begin()); + return ArgsSectionsConstIterator(indirect_iterator(_imp->sections.end())); } -ArgsHandler::ArgsGroupsConstIterator -ArgsHandler::end_args_groups() const +ArgsSection * +ArgsHandler::main_options_section() { - return ArgsGroupsConstIterator(_imp->groups.end()); + if (! _imp->main_options_section) + _imp->main_options_section.reset(new ArgsSection(this, "Options")); + return _imp->main_options_section.get(); } ArgsHandler::DescriptionLineConstIterator diff --git a/paludis/args/args_handler.hh b/paludis/args/args_handler.hh index a2437d1e6..8af12c751 100644 --- a/paludis/args/args_handler.hh +++ b/paludis/args/args_handler.hh @@ -20,6 +20,7 @@ #ifndef PALUDIS_GUARD_ARGS_ARGS_HANDLER_HH #define PALUDIS_GUARD_ARGS_ARGS_HANDLER_HH 1 +#include <paludis/args/args_section.hh> #include <paludis/args/args_group.hh> #include <paludis/util/instantiation_policy.hh> #include <paludis/util/private_implementation_pattern.hh> @@ -58,7 +59,7 @@ namespace paludis private InstantiationPolicy<ArgsHandler, instantiation_method::NonCopyableTag>, private PrivateImplementationPattern<ArgsHandler> { - friend class ArgsGroup; + friend class ArgsSection; friend std::ostream & operator<< (std::ostream &, const ArgsHandler &); protected: @@ -88,9 +89,9 @@ namespace paludis void add_description_line(const std::string & l); /** - * Add an new ArgsGroup (called by the ArgsGroup constructor). + * Add an new ArgsSection (called by the ArgsSection constructor). */ - void add(ArgsGroup * const); + void add(ArgsSection * const); /** * Dump, for --help output (called by operator<<). @@ -203,15 +204,21 @@ namespace paludis ///\} - ///\name Iterate over our groups + ///\name Iterate over our sections ///\{ - struct ArgsGroupsConstIteratorTag; - typedef WrappedForwardIterator<ArgsGroupsConstIteratorTag, ArgsGroup * const> ArgsGroupsConstIterator; + struct ArgsSectionsConstIteratorTag; + typedef WrappedForwardIterator<ArgsSectionsConstIteratorTag, const ArgsSection> ArgsSectionsConstIterator; - ArgsGroupsConstIterator begin_args_groups() const; + ArgsSectionsConstIterator begin_args_sections() const; + ArgsSectionsConstIterator end_args_sections() const; - ArgsGroupsConstIterator end_args_groups() const; + /** + * The 'Options' section. + * + * Created if it does not exist. + */ + ArgsSection * main_options_section() PALUDIS_ATTRIBUTE((warn_unused_result)); ///\} diff --git a/paludis/args/args_option.cc b/paludis/args/args_option.cc index b44786b7e..1b560c61b 100644 --- a/paludis/args/args_option.cc +++ b/paludis/args/args_option.cc @@ -69,7 +69,7 @@ ArgsOption::ArgsOption(ArgsGroup * const g, const std::string & our_long_name, _specified(false) { g->add(this); - g->handler()->add_option(this, our_long_name, our_short_name); + g->section()->handler()->add_option(this, our_long_name, our_short_name); } ArgsOption::~ArgsOption() @@ -80,7 +80,7 @@ void ArgsOption::remove() { _group->remove(this); - _group->handler()->remove_option(_long_name, _short_name); + _group->section()->handler()->remove_option(_long_name, _short_name); } SwitchArg::SwitchArg(ArgsGroup * const our_group, const std::string & our_long_name, char our_short_name, @@ -98,7 +98,7 @@ AliasArg::AliasArg(ArgsOption * const o, const std::string & our_long_name, bool ArgsOption(o->group(), our_long_name, '\0', "Alias for --" + o->long_name()), _other(o), _hidden(is_hidden) { - o->group()->handler()->add_option(o, our_long_name); + o->group()->section()->handler()->add_option(o, our_long_name); } StringArg::StringArg(ArgsGroup * const g, const std::string & our_long_name, diff --git a/paludis/args/args_section.cc b/paludis/args/args_section.cc new file mode 100644 index 000000000..4aba9ee2f --- /dev/null +++ b/paludis/args/args_section.cc @@ -0,0 +1,88 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2009 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/args/args_section.hh> +#include <paludis/args/args_handler.hh> +#include <paludis/util/private_implementation_pattern-impl.hh> +#include <paludis/util/wrapped_forward_iterator-impl.hh> +#include <paludis/util/indirect_iterator-impl.hh> +#include <list> + +using namespace paludis; +using namespace paludis::args; + +namespace paludis +{ + template <> + struct Implementation<ArgsSection> + { + ArgsHandler * const handler; + const std::string name; + std::list<ArgsGroup *> groups; + + Implementation(ArgsHandler * const h, const std::string & s) : + handler(h), + name(s) + { + } + }; +} + +ArgsSection::ArgsSection(ArgsHandler * const h, const std::string & s) : + PrivateImplementationPattern<ArgsSection>(new Implementation<ArgsSection>(h, s)) +{ + h->add(this); +} + +ArgsSection::~ArgsSection() +{ +} + +ArgsSection::GroupsConstIterator +ArgsSection::begin() const +{ + return GroupsConstIterator(indirect_iterator(_imp->groups.begin())); +} + +ArgsSection::GroupsConstIterator +ArgsSection::end() const +{ + return GroupsConstIterator(indirect_iterator(_imp->groups.end())); +} + +void +ArgsSection::add(ArgsGroup * const g) +{ + _imp->groups.push_back(g); +} + +ArgsHandler * +ArgsSection::handler() const +{ + return _imp->handler; +} + +const std::string +ArgsSection::name() const +{ + return _imp->name; +} + +template class PrivateImplementationPattern<ArgsSection>; + diff --git a/paludis/args/args_section.hh b/paludis/args/args_section.hh new file mode 100644 index 000000000..12215e9e5 --- /dev/null +++ b/paludis/args/args_section.hh @@ -0,0 +1,65 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2009 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_ARGS_ARGS_SECTION_HH +#define PALUDIS_GUARD_PALUDIS_ARGS_ARGS_SECTION_HH 1 + +#include <paludis/util/private_implementation_pattern.hh> +#include <paludis/util/attributes.hh> +#include <paludis/util/wrapped_forward_iterator-fwd.hh> +#include <string> + +namespace paludis +{ + namespace args + { + struct ArgsGroup; + struct ArgsHandler; + + /** + * Holds a number of ArgsGroup instances. + * + * \since 0.40 + * \ingroup g_args + */ + class PALUDIS_VISIBLE ArgsSection : + private PrivateImplementationPattern<ArgsSection> + { + public: + ArgsSection(ArgsHandler * const, const std::string &); + ~ArgsSection(); + + struct GroupsConstIteratorTag; + typedef WrappedForwardIterator<GroupsConstIteratorTag, const ArgsGroup> GroupsConstIterator; + GroupsConstIterator begin() const PALUDIS_ATTRIBUTE((warn_unused_result)); + GroupsConstIterator end() const PALUDIS_ATTRIBUTE((warn_unused_result)); + + ArgsHandler * handler() const PALUDIS_ATTRIBUTE((warn_unused_result)); + const std::string name() const PALUDIS_ATTRIBUTE((warn_unused_result)); + + void add(ArgsGroup * const); + }; + } + +#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE + extern template class PrivateImplementationPattern<args::ArgsSection>; +#endif +} + +#endif diff --git a/paludis/args/dep_list_args_group.cc b/paludis/args/dep_list_args_group.cc index 38fa1e153..0cf73b5a4 100644 --- a/paludis/args/dep_list_args_group.cc +++ b/paludis/args/dep_list_args_group.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2005, 2006, 2007, 2008 Ciaran McCreesh + * Copyright (c) 2005, 2006, 2007, 2008, 2009 Ciaran McCreesh * Copyright (c) 2007 David Leverton * * This file is part of the Paludis package manager. Paludis is free software; @@ -50,7 +50,7 @@ namespace } } -DepListArgsGroup::DepListArgsGroup(ArgsHandler * h) : +DepListArgsGroup::DepListArgsGroup(ArgsSection * h) : ArgsGroup(h, "DepList behaviour", "Modify dependency list generation behaviour. Use with caution."), diff --git a/paludis/args/dep_list_args_group.hh b/paludis/args/dep_list_args_group.hh index 16e8da607..fbf4daf7b 100644 --- a/paludis/args/dep_list_args_group.hh +++ b/paludis/args/dep_list_args_group.hh @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007 Ciaran McCreesh + * Copyright (c) 2006, 2007, 2009 Ciaran McCreesh * Copyright (c) 2007 David Leverton * * This file is part of the Paludis package manager. Paludis is free software; @@ -41,7 +41,7 @@ namespace paludis { public: /// Constructor. - DepListArgsGroup(ArgsHandler *); + DepListArgsGroup(ArgsSection *); /// Destructor ~DepListArgsGroup(); diff --git a/paludis/args/install_args_group.cc b/paludis/args/install_args_group.cc index cfd194293..c14653e0b 100644 --- a/paludis/args/install_args_group.cc +++ b/paludis/args/install_args_group.cc @@ -27,7 +27,7 @@ using namespace paludis; using namespace paludis::args; -InstallArgsGroup::InstallArgsGroup(ArgsHandler * h, const std::string & our_name, +InstallArgsGroup::InstallArgsGroup(ArgsSection * h, const std::string & our_name, const std::string & our_description) : ArgsGroup(h, our_name, our_description), diff --git a/paludis/args/install_args_group.hh b/paludis/args/install_args_group.hh index dceca9b16..280114cd2 100644 --- a/paludis/args/install_args_group.hh +++ b/paludis/args/install_args_group.hh @@ -52,7 +52,7 @@ namespace paludis { public: /// Constructor. - InstallArgsGroup(ArgsHandler *, const std::string &, const std::string &); + InstallArgsGroup(ArgsSection *, const std::string &, const std::string &); /// Destructor ~InstallArgsGroup(); diff --git a/paludis/args/man.cc b/paludis/args/man.cc index 17ba90a0d..63de28671 100644 --- a/paludis/args/man.cc +++ b/paludis/args/man.cc @@ -24,6 +24,7 @@ #include <ostream> #include <sstream> #include <algorithm> +#include <ctype.h> using namespace paludis; using namespace paludis::args; @@ -111,28 +112,31 @@ paludis::args::generate_doc(DocWriter & dw, const ArgsHandler * const h) dw.extra_description(*u); dw.end_description(); - dw.start_options(); - for (ArgsHandler::ArgsGroupsConstIterator a(h->begin_args_groups()), - a_end(h->end_args_groups()) ; a != a_end ; ++a) + for (ArgsHandler::ArgsSectionsConstIterator s(h->begin_args_sections()), s_end(h->end_args_sections()) ; + s != s_end ; ++s) { - dw.start_arg_group((*a)->name(), (*a)->description()); - - for (paludis::args::ArgsGroup::ConstIterator b((*a)->begin()), b_end((*a)->end()) ; - b != b_end ; ++b) + dw.start_options(s->name()); + for (ArgsSection::GroupsConstIterator a(s->begin()), + a_end(s->end()) ; a != a_end ; ++a) { - if (simple_visitor_cast<const paludis::args::AliasArg>(**b) && - simple_visitor_cast<const paludis::args::AliasArg>(**b)->hidden()) - continue; + dw.start_arg_group(a->name(), a->description()); - dw.arg_group_item((*b)->short_name(), (*b)->long_name(), - (*b)->can_be_negated() ? "no-" + (*b)->long_name() : "", (*b)->description()); + for (paludis::args::ArgsGroup::ConstIterator b(a->begin()), b_end(a->end()) ; + b != b_end ; ++b) + { + if (simple_visitor_cast<const paludis::args::AliasArg>(**b) && + simple_visitor_cast<const paludis::args::AliasArg>(**b)->hidden()) + continue; - ExtraText t(dw); - (*b)->accept(t); + dw.arg_group_item((*b)->short_name(), (*b)->long_name(), + (*b)->can_be_negated() ? "no-" + (*b)->long_name() : "", (*b)->description()); - } + ExtraText t(dw); + (*b)->accept(t); - dw.end_arg_group(); + } + dw.end_arg_group(); + } } dw.end_options(); @@ -203,9 +207,9 @@ HtmlWriter::start_description(const std::string & description) } void -HtmlWriter::start_options() +HtmlWriter::start_options(const std::string & s) { - _os << "<h2>Options</h2>" << endl; + _os << "<h2>" << s << "</h2>" << endl; } void @@ -393,9 +397,11 @@ ManWriter::start_description(const std::string & description) } void -ManWriter::start_options() +ManWriter::start_options(const std::string & s) { - _os << ".SH OPTIONS" << endl; + std::string upper_s; + std::transform(s.begin(), s.end(), std::back_inserter(upper_s), &::toupper); + _os << ".SH " << upper_s << endl; } void diff --git a/paludis/args/man.hh b/paludis/args/man.hh index dad292648..a454814cd 100644 --- a/paludis/args/man.hh +++ b/paludis/args/man.hh @@ -63,7 +63,7 @@ namespace paludis virtual void extra_description(const std::string & description) = 0; virtual void end_description() = 0; - virtual void start_options() = 0; + virtual void start_options(const std::string &) = 0; virtual void start_arg_group(const std::string & name, const std::string & description) = 0; virtual void arg_group_item(const char & short_name, const std::string & long_name, const std::string & negated_long_name, const std::string & description) = 0; @@ -122,7 +122,7 @@ namespace paludis void extra_description(const std::string & description); void end_description(); - void start_options(); + void start_options(const std::string &); void start_arg_group(const std::string & name, const std::string & description); void arg_group_item(const char & short_name, const std::string & long_name, const std::string & negated_long_name, const std::string & description); @@ -179,7 +179,7 @@ namespace paludis void extra_description(const std::string & description); void end_description(); - void start_options(); + void start_options(const std::string &); void start_arg_group(const std::string & name, const std::string & description); void arg_group_item(const char & short_name, const std::string & long_name, const std::string & negated_long_name, const std::string & description); diff --git a/src/clients/accerso/command_line.cc b/src/clients/accerso/command_line.cc index 0681313aa..d5ea32b29 100644 --- a/src/clients/accerso/command_line.cc +++ b/src/clients/accerso/command_line.cc @@ -27,14 +27,14 @@ template class paludis::InstantiationPolicy<CommandLine, paludis::instantiation_ CommandLine::CommandLine() : ArgsHandler(), - action_args(this, "Actions", + action_args(main_options_section(), "Actions", "Selects which basic action to perform. Exactly one action should " "be specified."), a_fetch(&action_args, "fetch", 'f', "Fetch necessary distfiles", false), a_version(&action_args, "version", 'V', "Display program version", false), a_help(&action_args, "help", 'h', "Display program help", false), - general_args(this, "General options", + general_args(main_options_section(), "General options", "Options which are relevant for most or all actions."), a_log_level(&general_args, "log-level", '\0'), a_no_colour(&general_args, "no-colour", '\0', "Do not use colour", false), diff --git a/src/clients/accerso/man_accerso.cc b/src/clients/accerso/man_accerso.cc index 534c19b78..2917ce694 100644 --- a/src/clients/accerso/man_accerso.cc +++ b/src/clients/accerso/man_accerso.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007 Ciaran McCreesh + * Copyright (c) 2006, 2007, 2009 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 @@ -35,7 +35,7 @@ namespace paludis::args::SwitchArg a_html; ManCommandLine() : - group(this, "", ""), + group(main_options_section(), "", ""), a_html(&group, "html", '\0', "", false) { } diff --git a/src/clients/adjutrix/command_line.cc b/src/clients/adjutrix/command_line.cc index cc505d335..39c1e62a4 100644 --- a/src/clients/adjutrix/command_line.cc +++ b/src/clients/adjutrix/command_line.cc @@ -26,7 +26,7 @@ template class paludis::InstantiationPolicy<CommandLine, paludis::instantiation_ CommandLine::CommandLine() : ArgsHandler(), - tree_action_args(this, "Tree-Oriented Actions", + tree_action_args(main_options_section(), "Tree-Oriented Actions", "Selects which basic tree-oriented action to perform. Exactly one action should " "be specified."), @@ -45,7 +45,7 @@ CommandLine::CommandLine() : a_what_needs_keywording(&tree_action_args, "what-needs-keywording", 'w', "Display what needs to be done to keyword a target", false), - profile_action_args(this, "Profile-Oriented Actions", + profile_action_args(main_options_section(), "Profile-Oriented Actions", "Selects which basic profile-oriented action to perform. Exactly one action should " "be specified."), @@ -53,7 +53,7 @@ CommandLine::CommandLine() : "display-default-system-resolution", 'S', "Display package names and versions that are included in " "the default resolution of the system set", false), - downgrade_check_args(this, "Downgrade Check Actions", + downgrade_check_args(main_options_section(), "Downgrade Check Actions", "Selects which downgrade check related action to perform. Exactly one action should " "be specified."), @@ -62,7 +62,7 @@ CommandLine::CommandLine() : a_downgrade_check(&downgrade_check_args, "downgrade-check", '\0', "Perform the dowgrade check", false), - general_action_args(this, "General Actions", + general_action_args(main_options_section(), "General Actions", "Selects which basic general action to perform. Exactly one action should " "be specified."), @@ -71,7 +71,7 @@ CommandLine::CommandLine() : a_help(&general_action_args, "help", 'h', "Display program help", false), - general_args(this, "General options", + general_args(main_options_section(), "General options", "Options which are relevant for most or all actions."), a_log_level(&general_args, "log-level", '\0'), a_no_colour(&general_args, "no-colour", '\0', "Do not use colour", false), @@ -81,7 +81,7 @@ CommandLine::CommandLine() : a_repository_directory(&general_args, "repository-dir", 'D', "Where to find the repository (default: detected from ./ or ../ or ../..)"), - tree_args(this, "Tree action options", + tree_args(main_options_section(), "Tree action options", "Options which are relevant for tree actions."), a_category(&tree_args, "category", 'C', "Matches with this category name only (may be specified multiple times)", @@ -90,14 +90,14 @@ CommandLine::CommandLine() : "Matches with this package name only (may be specified multiple times)", paludis::args::StringSetArg::StringSetArgOptions(), &paludis::PackageNamePartValidator::validate), - profile_args(this, "Profile action options", + profile_args(main_options_section(), "Profile action options", "Options which are relevant for profile actions."), a_profile(&profile_args, "profile", '\0', "Display results for this profile path, rather than all profiles (may be specified multiple times)"), a_unstable(&profile_args, "unstable", '\0', "Accept ~arch as well as arch", true), - configuration_options(this, "Configuration options", + configuration_options(main_options_section(), "Configuration options", "Options that control general configuration."), a_write_cache_dir(&configuration_options, "write-cache-dir", '\0', "Use a subdirectory named for the repository name under the specified directory for repository write cache"), diff --git a/src/clients/adjutrix/man_adjutrix.cc b/src/clients/adjutrix/man_adjutrix.cc index 061977718..91c443319 100644 --- a/src/clients/adjutrix/man_adjutrix.cc +++ b/src/clients/adjutrix/man_adjutrix.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007 Ciaran McCreesh + * Copyright (c) 2006, 2007, 2009 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 @@ -35,7 +35,7 @@ namespace paludis::args::SwitchArg a_html; ManCommandLine() : - group(this, "", ""), + group(main_options_section(), "", ""), a_html(&group, "html", '\0', "", false) { } diff --git a/src/clients/appareo/command_line.cc b/src/clients/appareo/command_line.cc index 1de6d45ba..d5324ec17 100644 --- a/src/clients/appareo/command_line.cc +++ b/src/clients/appareo/command_line.cc @@ -28,14 +28,14 @@ template class InstantiationPolicy<CommandLine, instantiation_method::SingletonT CommandLine::CommandLine() : ArgsHandler(), - action_args(this, "Actions", + action_args(main_options_section(), "Actions", "Selects which basic action to perform. Exactly one action should " "be specified."), a_manifest(&action_args, "manifest", 'm', "Create manifest file", false), a_version(&action_args, "version", 'V', "Display program version", false), a_help(&action_args, "help", 'h', "Display program help", false), - general_args(this, "General options", + general_args(main_options_section(), "General options", "Options which are relevant for most or all actions."), a_log_level(&general_args, "log-level", '\0'), a_no_colour(&general_args, "no-colour", '\0', "Do not use colour", false), @@ -53,7 +53,7 @@ CommandLine::CommandLine() : "Use a subdirectory named for the repository name under the specified directory for repository write cache"), a_report_file(&general_args, "report-file", 'r', "Write report to the specified file, rather than stdout"), - tree_args(this, "Tree action options", + tree_args(main_options_section(), "Tree action options", "Options which are relevant for tree actions."), a_category(&tree_args, "category", 'C', "Matches with this category name only (may be specified multiple times)", diff --git a/src/clients/appareo/man_appareo.cc b/src/clients/appareo/man_appareo.cc index 6def4b75e..26f379462 100644 --- a/src/clients/appareo/man_appareo.cc +++ b/src/clients/appareo/man_appareo.cc @@ -35,7 +35,7 @@ namespace paludis::args::SwitchArg a_html; ManCommandLine() : - group(this, "", ""), + group(main_options_section(), "", ""), a_html(&group, "html", '\0', "", false) { } diff --git a/src/clients/cave/cmd_help.cc b/src/clients/cave/cmd_help.cc index 46e7c6fff..b183f9b58 100644 --- a/src/clients/cave/cmd_help.cc +++ b/src/clients/cave/cmd_help.cc @@ -44,7 +44,7 @@ namespace args::SwitchArg a_all; HelpCommandLine() : - g_general(this, "General Options", "General Options"), + g_general(main_options_section(), "General Options", "General Options"), a_all(&g_general, "all", 'a', "Print all available commands to standard output.", false) { add_usage_line("[-a|--all] [COMMAND]"); diff --git a/src/clients/cave/cmd_perform.cc b/src/clients/cave/cmd_perform.cc index 8e3d226c4..13c02ccc8 100644 --- a/src/clients/cave/cmd_perform.cc +++ b/src/clients/cave/cmd_perform.cc @@ -93,14 +93,14 @@ namespace args::StringArg a_config_protect; PerformCommandLine() : - g_general_options(this, "General Options", + g_general_options(main_options_section(), "General Options", "General options for all actions"), a_if_supported(&g_general_options, "if-supported", '\0', "If the action is not supported, exit silently with success rather than erroring.", true), a_hooks(&g_general_options, "hooks", '\0', "Also execute the appropriate hooks for the action.", true), - g_fetch_action_options(this, "Fetch Action Options", + g_fetch_action_options(main_options_section(), "Fetch Action Options", "Options for if the action is 'fetch' or 'pretend-fetch'"), a_exclude_unmirrorable(&g_fetch_action_options, "exclude-unmirrorable", '\0', "Do not include unmirrorable components", true), @@ -111,7 +111,7 @@ namespace "Do not fetch any component that has not already been downloaded (but do verify " "components that have already been downloaded", true), - g_install_action_options(this, "Install Action Options", + g_install_action_options(main_options_section(), "Install Action Options", "Options for if the action is 'install'"), a_destination(&g_install_action_options, "destination", '\0', "The name of the repository to which the install should take place"), @@ -125,7 +125,7 @@ namespace a_skip_until_phase(&g_install_action_options, "skip-until-phase", '\0', "Skip every phase until a named phase is encounted"), - g_uninstall_action_options(this, "Uninstall Action Options", + g_uninstall_action_options(main_options_section(), "Uninstall Action Options", "Options for if the action is 'uninstall'"), a_config_protect(&g_uninstall_action_options, "config-protect", '\0', "Specify additional items to include in the config protection list") diff --git a/src/clients/cave/cmd_print_categories.cc b/src/clients/cave/cmd_print_categories.cc index a66c5c73a..e5be50e4d 100644 --- a/src/clients/cave/cmd_print_categories.cc +++ b/src/clients/cave/cmd_print_categories.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2008 Ciaran McCreesh + * Copyright (c) 2008, 2009 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 @@ -65,7 +65,7 @@ namespace args::StringSetArg a_repository; PrintCategoriesCommandLine() : - g_filters(this, "Filters", "Filter the output. Each filter may be specified more than once. The object " + g_filters(main_options_section(), "Filters", "Filter the output. Each filter may be specified more than once. The object " "specified by the filter does not have to exist."), a_containing(&g_filters, "containing", '\0', "Show only categories containing this package name. If specified " "multiple times, categories containing any of these package names are selected.", diff --git a/src/clients/cave/cmd_print_environment_metadata.cc b/src/clients/cave/cmd_print_environment_metadata.cc index 050463f93..d5763aacf 100644 --- a/src/clients/cave/cmd_print_environment_metadata.cc +++ b/src/clients/cave/cmd_print_environment_metadata.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2008 Ciaran McCreesh + * Copyright (c) 2008, 2009 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 @@ -66,12 +66,12 @@ namespace args::StringArg a_format; PrintEnvironmentMetadataCommandLine() : - g_filters(this, "Filters", "Filter the output. Each filter may be specified more than once."), + g_filters(main_options_section(), "Filters", "Filter the output. Each filter may be specified more than once."), a_raw_name(&g_filters, "raw-name", '\0', "Show only keys with this raw name. If specified more than once, " "any name match is accepted."), a_human_name(&g_filters, "human-name", '\0', "Show only keys with this human name. If specified more than once, " "any name match is accepted."), - g_display_options(this, "Display Options", "Controls the output format."), + g_display_options(main_options_section(), "Display Options", "Controls the output format."), a_format(&g_display_options, "format", '\0', "Select the output format. Special tokens recognised are " "%r for raw name, %h for human name, %v for value, %i for one space per subkey level, " "\\n for newline, \\t for tab. Default is '%i%i%r=%v\\n'.") diff --git a/src/clients/cave/cmd_print_id_contents.cc b/src/clients/cave/cmd_print_id_contents.cc index 9ed2bb8bc..d472abe70 100644 --- a/src/clients/cave/cmd_print_id_contents.cc +++ b/src/clients/cave/cmd_print_id_contents.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2008 Ciaran McCreesh + * Copyright (c) 2008, 2009 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 @@ -76,9 +76,9 @@ namespace args::StringArg a_format; PrintContentsCommandLine() : - g_spec_options(this, "Spec Options", "Alter how the supplied spec is used."), + g_spec_options(main_options_section(), "Spec Options", "Alter how the supplied spec is used."), a_best(&g_spec_options, "best", '\0', "If the spec matches multiple IDs, select the best ID rather than giving an error.", true), - g_display_options(this, "Display Options", "Controls the output format."), + g_display_options(main_options_section(), "Display Options", "Controls the output format."), a_format(&g_display_options, "format", '\0', "Select the output format. Special tokens recognised are " "%n for filename, %d for dirname, %b for basename, %t for symlink targets (blank for non-symlinks), " "%a for ' -> ' if we're a symlink and '' otherwise, %/ for '/' if we're a directory and '' otherwise, " diff --git a/src/clients/cave/cmd_print_id_metadata.cc b/src/clients/cave/cmd_print_id_metadata.cc index 9909566dc..ca31c3b40 100644 --- a/src/clients/cave/cmd_print_id_metadata.cc +++ b/src/clients/cave/cmd_print_id_metadata.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2008 Ciaran McCreesh + * Copyright (c) 2008, 2009 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 @@ -77,14 +77,14 @@ namespace args::StringArg a_format; PrintIDMetadataCommandLine() : - g_spec_options(this, "Spec Options", "Alter how the supplied spec is used."), + g_spec_options(main_options_section(), "Spec Options", "Alter how the supplied spec is used."), a_best(&g_spec_options, "best", '\0', "If the spec matches multiple IDs, select the best ID rather than giving an error.", true), - g_filters(this, "Filters", "Filter the output. Each filter may be specified more than once."), + g_filters(main_options_section(), "Filters", "Filter the output. Each filter may be specified more than once."), a_raw_name(&g_filters, "raw-name", '\0', "Show only keys with this raw name. If specified more than once, " "any name match is accepted."), a_human_name(&g_filters, "human-name", '\0', "Show only keys with this human name. If specified more than once, " "any name match is accepted."), - g_display_options(this, "Display Options", "Controls the output format."), + g_display_options(main_options_section(), "Display Options", "Controls the output format."), a_format(&g_display_options, "format", '\0', "Select the output format. Special tokens recognised are " "%r for raw name, %h for human name, %v for value, %i for one space per subkey level, " "\\n for newline, \\t for tab. Default is '%i%i%r=%v\\n'.") diff --git a/src/clients/cave/cmd_print_ids.cc b/src/clients/cave/cmd_print_ids.cc index 9717bae30..d30ac4e1a 100644 --- a/src/clients/cave/cmd_print_ids.cc +++ b/src/clients/cave/cmd_print_ids.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2008 Ciaran McCreesh + * Copyright (c) 2008, 2009 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 @@ -75,7 +75,7 @@ namespace args::StringSetArg a_with_mask; PrintIDsCommandLine() : - g_filters(this, "Filters", "Filter the output. Each filter may be specified more than once."), + g_filters(main_options_section(), "Filters", "Filter the output. Each filter may be specified more than once."), a_matching(&g_filters, "matching", '\0', "Show only IDs matching this spec. If specified multiple " "times, only IDs matching every spec are selected.", args::StringSetArg::StringSetArgOptions()), diff --git a/src/clients/cave/cmd_print_owners.cc b/src/clients/cave/cmd_print_owners.cc index 9d0af4f1d..49aeb1dd8 100644 --- a/src/clients/cave/cmd_print_owners.cc +++ b/src/clients/cave/cmd_print_owners.cc @@ -72,7 +72,7 @@ namespace args::EnumArg a_match; PrintOwnersCommandLine() : - g_owner_options(this, "Owner options", "Alter how the search is performed."), + g_owner_options(main_options_section(), "Owner options", "Alter how the search is performed."), a_match(&g_owner_options, "match", 'm', "Which match algorithm to use", args::EnumArg::EnumArgOptions ("auto", "If pattern starts with a /, full; if it contains a /, partial; otherwise, basename") diff --git a/src/clients/cave/cmd_print_repositories.cc b/src/clients/cave/cmd_print_repositories.cc index 92b90bbaa..17e821b6e 100644 --- a/src/clients/cave/cmd_print_repositories.cc +++ b/src/clients/cave/cmd_print_repositories.cc @@ -67,7 +67,7 @@ namespace args::StringSetArg a_repository_format; PrintRepositoriesCommandLine() : - g_filters(this, "Filters", "Filter the output."), + g_filters(main_options_section(), "Filters", "Filter the output."), a_repository_format(&g_filters, "format", '\0', "Show only repositories of a specific format") { add_usage_line("[ --format type ]"); diff --git a/src/clients/cave/cmd_resolve_cmdline.cc b/src/clients/cave/cmd_resolve_cmdline.cc index d30b79291..cbec80f58 100644 --- a/src/clients/cave/cmd_resolve_cmdline.cc +++ b/src/clients/cave/cmd_resolve_cmdline.cc @@ -27,7 +27,7 @@ ResolveCommandLine::ResolveCommandLine() : // a_execute(&g_execution_options, "execute", 'x', "Execute the suggested actions", true), // a_preserve_world(&g_execution_options, "preserve-world", '1', "Do not modify the 'world' set", true), // - g_convenience_options(this, "Convenience Options", "Broad behaviour options."), + g_convenience_options(main_options_section(), "Convenience Options", "Broad behaviour options."), a_lazy(&g_convenience_options, "lazy", 'z', "Do as little work as possible.", true), a_complete(&g_convenience_options, "complete", 'c', "Do all optional work.", true), a_everything(&g_convenience_options, "everything", 'e', "Do all optional work, and also reinstall", true), @@ -77,7 +77,7 @@ ResolveCommandLine::ResolveCommandLine() : // "new" // ), - g_explanations(this, "Explanations", "Options requesting the resolver explain a particular decision " + g_explanations(main_options_section(), "Explanations", "Options requesting the resolver explain a particular decision " "that it made"), a_explain(&g_explanations, "explain", '\0', "Explain why the resolver made a particular decision. The " "argument is a package dependency specification, so --explain dev-libs/boost or --explain qt:3" @@ -97,7 +97,7 @@ ResolveCommandLine::ResolveCommandLine() : // ("last", "Only the last package on the list"), // "all"), // - g_keep_options(this, "Reinstall Options", "Control whether installed packages are kept."), + g_keep_options(main_options_section(), "Reinstall Options", "Control whether installed packages are kept."), a_keep_targets(&g_keep_options, "keep-targets", 'K', "Select whether to keep target packages", args::EnumArg::EnumArgOptions @@ -136,7 +136,7 @@ ResolveCommandLine::ResolveCommandLine() : // a_reinstall_for_removals(&g_reinstall_options, "reinstall-for-removals", '\0', // "Select whether to rebuild packages if rebuilding would avoid an unsafe removal", true), // - g_slot_options(this, "Slot Options", "Control which slots are considered."), + g_slot_options(main_options_section(), "Slot Options", "Control which slots are considered."), a_target_slots(&g_slot_options, "target-slots", 'S', "Which slots to consider for targets", args::EnumArg::EnumArgOptions @@ -164,7 +164,7 @@ ResolveCommandLine::ResolveCommandLine() : "best-or-installed" ), - g_dependency_options(this, "Dependency Options", "Control which dependencies are followed."), + g_dependency_options(main_options_section(), "Dependency Options", "Control which dependencies are followed."), a_follow_installed_build_dependencies(&g_dependency_options, "follow-installed-build-dependencies", 'D', "Follow build dependencies for installed packages (default if --complete or --everything)", true), a_ignore_installed_dependencies(&g_dependency_options, "ignore-installed-dependencies", 'd', @@ -217,7 +217,7 @@ ResolveCommandLine::ResolveCommandLine() : // a_install_to_chroot(&g_destination_options, "install-to-chroot", '\0', "Install packages to the environment-configured chroot", true), // a_install_to_root(&g_destination_options, "install-to-root", '\0', "Install packages to /", true), - g_dump_options(this, "Dump Options", "Dump the resolver's state to stdout after completion, or when an " + g_dump_options(main_options_section(), "Dump Options", "Dump the resolver's state to stdout after completion, or when an " "error occurs. For debugging purposes; produces rather a lot of noise."), a_dump(&g_dump_options, "dump", '\0', "Dump debug output", true), a_dump_dependencies(&g_dump_options, "dump-dependencies", '\0', "If dumping, also dump the " diff --git a/src/clients/cave/cmd_show.cc b/src/clients/cave/cmd_show.cc index d92361619..40743e486 100644 --- a/src/clients/cave/cmd_show.cc +++ b/src/clients/cave/cmd_show.cc @@ -91,7 +91,7 @@ namespace args::SwitchArg a_flat; ShowCommandLine() : - g_object_options(this, "Object Options", "Alter how objects are interpreted."), + g_object_options(main_options_section(), "Object Options", "Alter how objects are interpreted."), a_type(&g_object_options, "type", '\0', "Specify the type of the specified objects.", args::EnumArg::EnumArgOptions ("auto", "Automatically determine the type") @@ -100,12 +100,12 @@ namespace ("wildcard", "Treat the objects as a wildcarded package spec") ("package", "Treat the objects as an unwildcarded package spec, showing all matches for wildcards"), "auto"), - g_key_options(this, "Key Options", "Control which keys are shown."), + g_key_options(main_options_section(), "Key Options", "Control which keys are shown."), a_complex_keys(&g_key_options, "complex-keys", 'c', "Show complex keys", true), a_internal_keys(&g_key_options, "internal-keys", 'i', "Show keys regardless of importance, including internal-only values", true), - g_display_options(this, "Display Options", "Controls the output format."), + g_display_options(main_options_section(), "Display Options", "Controls the output format."), a_flat(&g_display_options, "flat", 'f', "Do not spread key values over multiple lines", true) { diff --git a/src/clients/cave/cmd_update_world.cc b/src/clients/cave/cmd_update_world.cc index 7e4a85ba3..2a18e7345 100644 --- a/src/clients/cave/cmd_update_world.cc +++ b/src/clients/cave/cmd_update_world.cc @@ -63,7 +63,7 @@ namespace args::SwitchArg a_set; UpdateWorldCommandLine() : - g_update_options(this, "Update Options", "Alter how updates are performed."), + g_update_options(main_options_section(), "Update Options", "Alter how updates are performed."), a_remove(&g_update_options, "remove", 'r', "Remove the specified items instead of adding them", true), a_set(&g_update_options, "set", 's', "The parameters are set names, not package names", true) { diff --git a/src/clients/cave/command_command_line.cc b/src/clients/cave/command_command_line.cc index 88285a067..4a6b698a5 100644 --- a/src/clients/cave/command_command_line.cc +++ b/src/clients/cave/command_command_line.cc @@ -23,7 +23,7 @@ using namespace paludis; using namespace cave; CaveCommandCommandLine::CaveCommandCommandLine() : - g_global_options(this, "Global Options", "Global options, used by every subcommand."), + g_global_options(main_options_section(), "Global Options", "Global options, used by every subcommand."), a_help(&g_global_options, "help", 'h', "display help message", false) { } diff --git a/src/clients/cave/command_line.cc b/src/clients/cave/command_line.cc index 76cf97b5e..527bfe858 100644 --- a/src/clients/cave/command_line.cc +++ b/src/clients/cave/command_line.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2008 Ciaran McCreesh + * Copyright (c) 2008, 2009 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 @@ -23,7 +23,7 @@ using namespace paludis; using namespace cave; CaveCommandLine::CaveCommandLine() : - g_global_options(this, "Global Options", "Global options, used by every subcommand."), + g_global_options(main_options_section(), "Global Options", "Global options, used by every subcommand."), a_environment(&g_global_options, "environment", 'E', "Environment specification (class:suffix, both parts optional)"), a_log_level(&g_global_options, "log-level", '\0') diff --git a/src/clients/cave/man_cave.cc b/src/clients/cave/man_cave.cc index 79bd1ff7e..c5d9cae3a 100644 --- a/src/clients/cave/man_cave.cc +++ b/src/clients/cave/man_cave.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2008 Ciaran McCreesh + * Copyright (c) 2008, 2009 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 @@ -39,7 +39,7 @@ namespace paludis::args::SwitchArg a_html; ManCommandLine() : - group(this, "", ""), + group(main_options_section(), "", ""), a_html(&group, "html", '\0', "", false) { } diff --git a/src/clients/importare/command_line.cc b/src/clients/importare/command_line.cc index db163cad8..10b1cbc7d 100644 --- a/src/clients/importare/command_line.cc +++ b/src/clients/importare/command_line.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2007, 2008 Ciaran McCreesh + * Copyright (c) 2007, 2008, 2009 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 @@ -27,14 +27,14 @@ template class paludis::InstantiationPolicy<CommandLine, paludis::instantiation_ CommandLine::CommandLine() : ArgsHandler(), - action_args(this, "Actions", + action_args(main_options_section(), "Actions", "Selects which basic action to perform. Exactly one action should " "be specified."), a_install(&action_args, "install", 'i', "Install one or more packages (default)", false), a_version(&action_args, "version", 'V', "Display program version", false), a_help(&action_args, "help", 'h', "Display program help", false), - general_args(this, "General options", + general_args(main_options_section(), "General options", "Options which are relevant for most or all actions."), a_log_level(&general_args, "log-level", '\0'), a_no_colour(&general_args, "no-colour", '\0', "Do not use colour", false), @@ -42,24 +42,24 @@ CommandLine::CommandLine() : a_environment(&general_args, "environment", 'E', "Environment specification (class:suffix, both parts optional)"), a_compact(&general_args, "compact", '\0', "Display output using one line per entry", true), - source_args(this, "Source options", + source_args(main_options_section(), "Source options", "Options affecting the source image"), a_location(&source_args, "location", 'l', "Location of source image (default: current directory)"), a_install_under(&source_args, "install-under", 'u', "Install under a given directory (default: /)"), a_rewrite_ids_over_to_root(&source_args, "rewrite-ids-over-to-root", 'r', "Change any UID or GID over this value to 0 (-1 disables, default)"), - metadata_args(this, "Metadata options", + metadata_args(main_options_section(), "Metadata options", "Options affecting generated metadata"), a_description(&metadata_args, "description", 'D', "Specify a package description"), a_build_dependency(&metadata_args, "build-dependency", 'B', "Specify a build dependency"), a_run_dependency(&metadata_args, "run-dependency", 'R', "Specify a run dependency"), a_preserve_metadata(&metadata_args, "preserve-metadata", 'P', "If replacing a package, copy its description and dependencies", true), - install_args(this, "Install options", + install_args(main_options_section(), "Install options", "Options which are relevant for --install"), - dl_args(this) + dl_args(main_options_section()) { add_usage_line("[ --install ] [ --location path/ ] category/package [ version ] [ slot ]"); diff --git a/src/clients/importare/man_importare.cc b/src/clients/importare/man_importare.cc index 534c19b78..2917ce694 100644 --- a/src/clients/importare/man_importare.cc +++ b/src/clients/importare/man_importare.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007 Ciaran McCreesh + * Copyright (c) 2006, 2007, 2009 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 @@ -35,7 +35,7 @@ namespace paludis::args::SwitchArg a_html; ManCommandLine() : - group(this, "", ""), + group(main_options_section(), "", ""), a_html(&group, "html", '\0', "", false) { } diff --git a/src/clients/inquisitio/command_line.cc b/src/clients/inquisitio/command_line.cc index d229ec24d..b09507e8c 100644 --- a/src/clients/inquisitio/command_line.cc +++ b/src/clients/inquisitio/command_line.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2007, 2008 Ciaran McCreesh + * Copyright (c) 2007, 2008, 2009 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 @@ -28,21 +28,21 @@ template class paludis::InstantiationPolicy<CommandLine, paludis::instantiation_ CommandLine::CommandLine() : ArgsHandler(), - action_args(this, "Actions", + action_args(main_options_section(), "Actions", "Selects which basic action to perform. Exactly one action should " "be specified."), a_search(&action_args, "search", 's', "Search for a package", false), a_version(&action_args, "version", 'V', "Display program version", false), a_help(&action_args, "help", 'h', "Display program help", false), - general_args(this, "General options", + general_args(main_options_section(), "General options", "Options that are relevant for most or all actions."), a_log_level(&general_args, "log-level", '\0'), a_no_colour(&general_args, "no-colour", '\0', "Do not use colour", false), a_no_color(&a_no_colour, "no-color"), a_environment(&general_args, "environment", 'E', "Environment specification (class:suffix, both parts optional)"), - match_args(this, "Matching options", + match_args(main_options_section(), "Matching options", "Options that control which packages are matched."), a_keys(&match_args, "keys", 'k', "Match using listed metadata keys, rather than name and description"), a_matcher(&match_args, "matcher", 'm', "Which match algorithm to use", @@ -55,7 +55,7 @@ CommandLine::CommandLine() : a_enabled_only(&match_args, "enabled-only", 'e', "When searching spec trees, only look in enabled subtrees", true), a_not(&match_args, "not", 'n', "Select packages that do not match", true), - filter_args(this, "Filter options", + filter_args(main_options_section(), "Filter options", "Options that control whether or not a package is considered for matching."), a_repository(&filter_args, "repository", 'r', "Matches with this repository name only", @@ -74,7 +74,7 @@ CommandLine::CommandLine() : ("all", "All packages (default if --repository specified)"), "installable"), - output_args(this, "Output options", + output_args(main_options_section(), "Output options", "Options that control how output is generated."), a_compact(&output_args, "compact", '\0', "Display output using one line per entry", true), diff --git a/src/clients/inquisitio/man_inquisitio.cc b/src/clients/inquisitio/man_inquisitio.cc index 061977718..91c443319 100644 --- a/src/clients/inquisitio/man_inquisitio.cc +++ b/src/clients/inquisitio/man_inquisitio.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007 Ciaran McCreesh + * Copyright (c) 2006, 2007, 2009 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 @@ -35,7 +35,7 @@ namespace paludis::args::SwitchArg a_html; ManCommandLine() : - group(this, "", ""), + group(main_options_section(), "", ""), a_html(&group, "html", '\0', "", false) { } diff --git a/src/clients/instruo/command_line.cc b/src/clients/instruo/command_line.cc index 4f58e2237..93ad16c1d 100644 --- a/src/clients/instruo/command_line.cc +++ b/src/clients/instruo/command_line.cc @@ -27,14 +27,14 @@ template class paludis::InstantiationPolicy<CommandLine, paludis::instantiation_ CommandLine::CommandLine() : ArgsHandler(), - action_args(this, "Actions", + action_args(main_options_section(), "Actions", "Selects which basic action to perform. Exactly one action should " "be specified."), a_generate_cache(&action_args, "generate-cache", 'g', "Generate cache", false), a_version(&action_args, "version", 'V', "Display program version", false), a_help(&action_args, "help", 'h', "Display program help", false), - general_args(this, "General options", + general_args(main_options_section(), "General options", "Options which are relevant for most or all actions."), a_log_level(&general_args, "log-level", '\0'), a_no_colour(&general_args, "no-colour", '\0', "Do not use colour", false), diff --git a/src/clients/instruo/man_instruo.cc b/src/clients/instruo/man_instruo.cc index 0ca7ed9ea..b78195dc1 100644 --- a/src/clients/instruo/man_instruo.cc +++ b/src/clients/instruo/man_instruo.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007 Ciaran McCreesh + * Copyright (c) 2006, 2007, 2009 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 @@ -35,7 +35,7 @@ namespace paludis::args::SwitchArg a_html; ManCommandLine() : - group(this, "", ""), + group(main_options_section(), "", ""), a_html(&group, "html", '\0', "", false) { } diff --git a/src/clients/paludis/command_line.cc b/src/clients/paludis/command_line.cc index 195261fad..6b666a2cb 100644 --- a/src/clients/paludis/command_line.cc +++ b/src/clients/paludis/command_line.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008 Ciaran McCreesh + * Copyright (c) 2006, 2007, 2008, 2009 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 @@ -27,7 +27,7 @@ template class paludis::InstantiationPolicy<CommandLine, paludis::instantiation_ CommandLine::CommandLine() : ArgsHandler(), - action_args(this, "Actions", + action_args(main_options_section(), "Actions", "Selects which basic action to perform. Exactly one action should " "be specified."), a_query(&action_args, "query", 'q', "Query for package information", false), @@ -44,7 +44,7 @@ CommandLine::CommandLine() : a_info(&action_args, "info", 'I', "Display program version and system information", false), a_help(&action_args, "help", 'h', "Display program help", false), - action_args_internal(this, "More actions", + action_args_internal(main_options_section(), "More actions", "Additional actions, mostly for script and internal use."), a_has_version(&action_args_internal, "has-version", '\0', "Check whether the specified spec is installed", false), a_best_version(&action_args_internal, "best-version", '\0', "Display the best version of the specified spec", false), @@ -65,7 +65,7 @@ CommandLine::CommandLine() : a_regenerate_installable_cache(&action_args_internal, "regenerate-installable-cache", '\0', "Regenerate (non-metadata) cache for installable repositories", false), - general_args(this, "General options", + general_args(main_options_section(), "General options", "Options which are relevant for most or all actions."), a_log_level(&general_args, "log-level", '\0'), a_no_colour(&general_args, "no-colour", '\0', "Do not use colour", false), @@ -77,13 +77,13 @@ CommandLine::CommandLine() : a_multitask(&general_args, "multitask", '\0', "Perform tasks in parallel, where supported (currently --sync only)", true), a_compact(&general_args, "compact", '\0', "Display output using one line per entry (--install, --query)", true), - query_args(this, "Query options", + query_args(main_options_section(), "Query options", "Options which are relevant for --query."), a_show_deps(&query_args, "show-deps", 'D', "Show dependencies", true), a_show_authors(&query_args, "show-authors", 'A', "Show author information", true), a_show_metadata(&query_args, "show-metadata", 'M', "Show raw metadata", true), - install_args(this, "Install, Uninstall options", + install_args(main_options_section(), "Install, Uninstall options", "Options which are relevant for --install, --uninstall or --uninstall-unused."), a_serialised(&install_args, "serialised", '\0', @@ -91,7 +91,7 @@ CommandLine::CommandLine() : "list. The parameter to this option specifies the format version. Used by resume commands and Paludis " "exec()ing itself upon an upgrade; not to be used manually"), - uninstall_args(this, "Uninstall options", + uninstall_args(main_options_section(), "Uninstall options", "Options which are relevant for --uninstall."), a_with_unused_dependencies(&uninstall_args, "with-unused-dependencies", '\0', "Also uninstall any dependencies of the target that are no longer used", true), @@ -102,9 +102,9 @@ CommandLine::CommandLine() : a_permit_unsafe_uninstalls(&uninstall_args, "permit-unsafe-uninstalls", '\0', "Allow depended-upon packages to uninstalled", true), - dl_args(this), + dl_args(main_options_section()), - list_args(this, "List options", + list_args(main_options_section(), "List options", "Options relevant for one or more of the --list actions."), a_repository(&list_args, "repository", '\0', "Matches with this repository name only", paludis::args::StringSetArg::StringSetArgOptions(), &paludis::RepositoryNameValidator::validate), @@ -116,7 +116,7 @@ CommandLine::CommandLine() : a_set(&list_args, "set", '\0', "Matches with this package set name only", paludis::args::StringSetArg::StringSetArgOptions(), &paludis::SetNameValidator::validate), - owner_args(this, "Owner options", + owner_args(main_options_section(), "Owner options", "Options relevant for the --owner actions."), a_full_match(&owner_args, "full-match", '\0', "Match whole filename", true) { diff --git a/src/clients/paludis/man_paludis.cc b/src/clients/paludis/man_paludis.cc index 534c19b78..2917ce694 100644 --- a/src/clients/paludis/man_paludis.cc +++ b/src/clients/paludis/man_paludis.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007 Ciaran McCreesh + * Copyright (c) 2006, 2007, 2009 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 @@ -35,7 +35,7 @@ namespace paludis::args::SwitchArg a_html; ManCommandLine() : - group(this, "", ""), + group(main_options_section(), "", ""), a_html(&group, "html", '\0', "", false) { } diff --git a/src/clients/qualudis/man_qualudis.cc b/src/clients/qualudis/man_qualudis.cc index a10ec9baf..c21a1761e 100644 --- a/src/clients/qualudis/man_qualudis.cc +++ b/src/clients/qualudis/man_qualudis.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007 Ciaran McCreesh + * Copyright (c) 2006, 2007, 2009 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 @@ -35,7 +35,7 @@ namespace paludis::args::SwitchArg a_html; ManCommandLine() : - group(this, "", ""), + group(main_options_section(), "", ""), a_html(&group, "html", '\0', "", false) { } diff --git a/src/clients/qualudis/qualudis_command_line.cc b/src/clients/qualudis/qualudis_command_line.cc index 1e19dcc98..9b0d690f1 100644 --- a/src/clients/qualudis/qualudis_command_line.cc +++ b/src/clients/qualudis/qualudis_command_line.cc @@ -25,7 +25,7 @@ template class paludis::InstantiationPolicy<QualudisCommandLine, paludis::instan QualudisCommandLine::QualudisCommandLine() : ArgsHandler(), - action_args(this, "Actions", + action_args(main_options_section(), "Actions", "Selects which basic action to perform. Up to one action should " "be specified. If no action is specified, the directories specifed " "on the command line (or, if none, the current directory) are " @@ -33,7 +33,7 @@ QualudisCommandLine::QualudisCommandLine() : a_version(&action_args, "version", 'V', "Display program version", false), a_help(&action_args, "help", 'h', "Display program help", false), - check_options(this, "Options for general checks", + check_options(main_options_section(), "Options for general checks", "Options relevant for the --owner actions."), a_log_level(&check_options, "log-level", 'L'), @@ -57,7 +57,7 @@ QualudisCommandLine::QualudisCommandLine() : a_repository_directory(&check_options, "repository-dir", 'D', "Where to find the repository (default: detected from ./ or ../ or ../..)"), - configuration_options(this, "Configuration options", + configuration_options(main_options_section(), "Configuration options", "Options that control general configuration."), a_write_cache_dir(&configuration_options, "write-cache-dir", '\0', "Use a subdirectory named for the repository name under the specified directory for repository write cache"), diff --git a/src/clients/reconcilio/command_line.cc b/src/clients/reconcilio/command_line.cc index 136b9e7b5..cb2ad7863 100644 --- a/src/clients/reconcilio/command_line.cc +++ b/src/clients/reconcilio/command_line.cc @@ -28,14 +28,14 @@ template class InstantiationPolicy<CommandLine, instantiation_method::SingletonT CommandLine::CommandLine() : ArgsHandler(), - action_args(this, "Actions", + action_args(main_options_section(), "Actions", "Selects which basic action to perform. At most one action should " "be specified."), a_fix_linkage(&action_args, "fix-linkage", '\0', "Search for and rebuild packages linked against non-existant libraries (default)", false), a_version(&action_args, "version", 'V', "Display program version", false), a_help(&action_args, "help", 'h', "Display program help", false), - general_args(this, "General options", + general_args(main_options_section(), "General options", "Options which are relevant for most or all actions."), a_log_level(&general_args, "log-level", '\0'), a_no_colour(&general_args, "no-colour", '\0', "Do not use colour", false), @@ -46,13 +46,13 @@ CommandLine::CommandLine() : "Save the resume command to a file. If the filename contains 'XXXXXX', use mkstemp(3) to generate the filename"), a_compact(&general_args, "compact", '\0', "Display output using one line per entry", true), - fix_linkage_args(this, "Fix Linkage options", + fix_linkage_args(main_options_section(), "Fix Linkage options", "Options which are relevant for --fix-linkage."), a_library(&fix_linkage_args, "library", '\0', "Only rebuild packages linked against this library, even if it exists"), - install_args(this, "Install options", + install_args(main_options_section(), "Install options", "Options which are relevant for the install process."), - dl_args(this) + dl_args(main_options_section()) { add_usage_line("[ --fix-linkage ] [fix linkage options]"); add_usage_line("--help"); diff --git a/src/clients/reconcilio/man_reconcilio.cc b/src/clients/reconcilio/man_reconcilio.cc index 061977718..91c443319 100644 --- a/src/clients/reconcilio/man_reconcilio.cc +++ b/src/clients/reconcilio/man_reconcilio.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007 Ciaran McCreesh + * Copyright (c) 2006, 2007, 2009 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 @@ -35,7 +35,7 @@ namespace paludis::args::SwitchArg a_html; ManCommandLine() : - group(this, "", ""), + group(main_options_section(), "", ""), a_html(&group, "html", '\0', "", false) { } |